PublicAPI.CRM.SaleELMA API Documentation
Deal
Access path: PublicAPI.CRM.Sale
Methods

  NameDescription
Public methodAddAuthorPermission
Grant the author permission for the contractor
Public methodAddComment(Sale, String)
Add a comment to the sale
Public methodAddComment(Sale, String, User)
Public methodAddPermission(Sale, OrganizationItem, Permission)
Grant permissions for a contractor to a job position
Public methodAddPermission(Sale, User, Permission)
Grant a user permissions for a contractor
Public methodAddPermission(Sale, UserGroup, Permission)
Grant a user group permissions for a contractor
Public methodCount 
Returns the total number of objects of this type
Public methodCount(IEntityFilter)
Get Total Number of Objects by Filter
Public methodCreate
Create New Entity (without a Database entry)
Public methodCreateInpayment
Create an inpayment, linked to the sale. Creates an object without saving to the database
Public methodDelete
Delete Object
Public methodDeleteAuthorPermission
Remove permissions for a contractor from the author
Public methodDeletePermission(Sale, OrganizationItem)
Delete all the permissions for a contractor from a job position
Public methodDeletePermission(Sale, User)
Remove all the permissions for a contractor from a user
Public methodDeletePermission(Sale, UserGroup)
Remove all the permissions for a contractor from a user group
Public methodDeletePermission(Sale, OrganizationItem, Permission)
Remove permissions for a contractor from a job position
Public methodDeletePermission(Sale, User, Permission)
Remove permissions to manage a contractor from a user
Public methodDeletePermission(Sale, UserGroup, Permission)
Remove permissions to manage a contractor from a user
Public methodDisableInheritPermissions
Disable inheriting permissions from category
Public methodEnableInheritPermissions
Enable inheriting permissions from a category
Public methodFilter
Creates an assistant for working with the "Deal" object filter
Public methodFind(FetchOptions)
Find objects according to fetch options
Public methodFind(String)
Find objects according to the filter in the EQL language
Public methodFind(IEntityFilter, FetchOptions)
Fing objects according to fetch options and filter
Public methodFindByIdArray
Find All Objects by Array IDs
Public methodGetAllInpayments
Get all the sale inpayments
Public methodIsDirty
Check, if there are unsaved changes in the object
Public methodIsNew
Check, if the object is new (not saved in the database)
Public methodLoad(Guid)
Load by UID. If not found, an exception is invoked
Public methodLoad(Int64)
Load by ID. If not found, an exception is invoked
Public methodLoadOrCreate(Guid)
Load by ID. If not found, the new object is returned
Public methodLoadOrCreate(Int64)
Load by ID. If not found, the new object is returned
Public methodLoadOrNull(Guid)
Load by UID. If not found, null is returned
Public methodLoadOrNull(Int64)
Load by ID. If not found, null is returned
Public methodLoadSaleTypeOrNull
Load a deal type by name, if there is not one, null is returned
Public methodRefresh
Refresh (read over) Object from Database
Public methodSave
Save Object to Database
Public methodSetActiveStatus
Set the "Active" status
Public methodSetNegativeClosedStatus
Set the "Closed(unsuccessfully)" status
Public methodSetPositiveClosedStatus
Set the "Closed(successfully)" status
Public methodSetPostponedStatus
Set the "Postponed" status
Public methodSetStage
Change a deal stage
Public methodSetStatus
Change Sale Status
Back to Top
Properties

  NameDescription
Public propertyTypeUid
Returns the unique object identifier "Deal"
Back to Top
Remarks

Section containing methods for managing deals
Examples

Create a deal for the contractor, created here

var mySale = PublicAPI.CRM.Contractor.CreateSale(myContractor);

Before you start working with mySale variable, fill in its requested fields (except for "Contractor", it is already filled)

//Deal Name
mySale.Name = "Selling equipment to New World ltd.";
//Select the administrator as the user responsible
mySale.Responsible = PublicAPI.Security.User.LoadOrNull(1);
//Load deal type by name and move it to the deal
mySale.SaleType = PublicAPI.CRM.Sale.LoadSaleTypeOrNull("Deal type");

Add a comment to the deal

PublicAPI.CRM.Sale.AddComment(mySale, "mySale is a deal, created for myContarctor");

Remember to save the object to the database for its correct operation

mySale.Save();

After creating an inpayment and adding it to the deal, change deal status from "Active" toe "Closed(Success)"

PublicAPI.CRM.Sale.SetPositiveClosedStatus(mySale, "Deal is successfully closed, no comments");

See Also