Class NSSaleEntity

The Sale Entity contains the sale amount, currency, and sale members. Sales are linked to contacts, persons, and/or projects.

Constructors

NSSaleEntity()

Initializes a new instance of the NSSaleEntity class.

Declaration

NSSaleEntity

Methods

GetActiveErpLinks()

Declaration

Integer GetActiveErpLinks()

Examples

NSSaleEntity thing;
Integer activeErpLinks = thing.GetActiveErpLinks();

Returns

Type Description
Integer The number of active ERP links.

GetActiveLinks()

Declaration

Integer GetActiveLinks()

Examples

NSSaleEntity thing;
Integer activeLinks = thing.GetActiveLinks();

Returns

Type Description
Integer Number of active links to sale, document, appointment.

GetAmount()

Declaration

Float GetAmount()

Examples

NSSaleEntity thing;
Float amount = thing.GetAmount();

Returns

Type Description
Float Total sale amount.

GetAppointment()

Declaration

NSAppointment GetAppointment()

Examples

NSSaleEntity thing;
NSAppointment appointment = thing.GetAppointment();

Returns

Type Description
NSAppointment

GetAssociate()

Declaration

NSAssociate GetAssociate()

Examples

NSSaleEntity thing;
NSAssociate associate = thing.GetAssociate();

Returns

Type Description
NSAssociate The sale owner.

GetCompetitor()

Declaration

NSCompetitor GetCompetitor()

Examples

NSSaleEntity thing;
NSCompetitor competitor = thing.GetCompetitor();

Returns

Type Description
NSCompetitor List of all possible competitors.

GetCompleted()

Declaration

Integer GetCompleted()

Examples

NSSaleEntity thing;
Integer completed = thing.GetCompleted();

Returns

Type Description
Integer The Sale completed state.

GetContact()

Declaration

NSContact GetContact()

Examples

NSSaleEntity thing;
NSContact contact = thing.GetContact();

Returns

Type Description
NSContact The contact associated with the sale. It may also be 0 if no contact is associated with the sale.

GetCreatedBy()

Declaration

NSAssociate GetCreatedBy()

Examples

NSSaleEntity thing;
NSAssociate createdBy = thing.GetCreatedBy();

Returns

Type Description
NSAssociate Who created to sale.

GetCreatedDate()

Declaration

DateTime GetCreatedDate()

Examples

NSSaleEntity thing;
DateTime createdDate = thing.GetCreatedDate();

Returns

Type Description
DateTime Registered date.

GetCredited()

Declaration

NSCredited GetCredited()

Examples

NSSaleEntity thing;
NSCredited credited = thing.GetCredited();

Returns

Type Description
NSCredited List of who is to be credited for the sale.

GetCurrency()

Declaration

NSCurrency GetCurrency()

Examples

NSSaleEntity thing;
NSCurrency currency = thing.GetCurrency();

Returns

Type Description
NSCurrency The currency the sale object was sold in.

GetCustomFields()

Gets the user-defined + extra fields on a SaleEntity as a map.

Declaration

Map GetCustomFields()

Examples

NSSaleEntity thing;
Map fields = thing.GetCustomFields();
String oldValue = fields.get("SuperOffice:1");
fields.insert("SuperOffice:1", "NewValue");
for (fields.first(); !fields.eof(); fields.next())
  printLine(fields.getKey() + ":  " + fields.getVal());

Returns

Type Description
Map

GetEarning()

Declaration

Float GetEarning()

Examples

NSSaleEntity thing;
Float earning = thing.GetEarning();

Returns

Type Description
Float Earning on sale.

GetEarningPercent()

Declaration

Float GetEarningPercent()

Examples

NSSaleEntity thing;
Float earningPercent = thing.GetEarningPercent();

Returns

Type Description
Float Earning as percent of total.

GetExtraFields()

Gets the extra fields on SaleEntity as a map.

Declaration

Map GetExtraFields()

Examples

NSSaleEntity thing;
Map fields = thing.GetExtraFields();
String oldValue = fields.get("x_foobar");
fields.insert("x_foobar", "NewValue");
for (fields.first(); !fields.eof(); fields.next())
  printLine(fields.getKey() + ":  " + fields.getVal());

Returns

Type Description
Map

GetHeading()

Declaration

String GetHeading()

Examples

NSSaleEntity thing;
String heading = thing.GetHeading();

Returns

Type Description
String Sale heading (short description?).

GetIsPublished()

Declaration

Bool GetIsPublished()

Returns

Type Description
Bool Should this SaleEntity be published and visible to strangers?

GetLinks()

Declaration

NSLink[] GetLinks()

Examples

NSSaleEntity thing;
NSLink[] links = thing.GetLinks();

Returns

Type Description
NSLink[] List of all elements linked to the sale.

GetNextDueDate()

Declaration

DateTime GetNextDueDate()

Examples

NSSaleEntity thing;
DateTime nextDueDate = thing.GetNextDueDate();

Returns

Type Description
DateTime Next due date, this is a de.normalization of 'closest future activity date, or most recent if no future activities'.

GetNumber()

Declaration

String GetNumber()

Examples

NSSaleEntity thing;
String number = thing.GetNumber();

Returns

Type Description
String Alphanumeric user field.

GetPerson()

A sale may also be connected to a person. This must be a contact person registered on the current contact. This does not mean that a person is required.

Declaration

NSPerson GetPerson()

Examples

NSSaleEntity thing;
NSPerson person = thing.GetPerson();

Returns

Type Description
NSPerson

GetPostit()

Declaration

String GetPostit()

Examples

NSSaleEntity thing;
String postit = thing.GetPostit();

Returns

Type Description
String The actual text, max 2047 significant characters even though it is stored as a larger data type on some databases.

GetProbability()

Declaration

Integer GetProbability()

Examples

NSSaleEntity thing;
Integer probability = thing.GetProbability();

Returns

Type Description
Integer Actual probability, may differ from the one in the list.

GetProject()

A sale may also be connected to a project, so you see the sale both on the company card, and on the project card. This does not mean that a project is required.

Declaration

NSProject GetProject()

Examples

NSSaleEntity thing;
NSProject project = thing.GetProject();

Returns

Type Description
NSProject

GetPublishEventDate()

Declaration

DateTime GetPublishEventDate()

Returns

Type Description
DateTime Publish event date on SaleEntity.

GetPublishFrom()

Declaration

DateTime GetPublishFrom()

Returns

Type Description
DateTime Publish from date on SaleEntity.

GetPublishTo()

Declaration

DateTime GetPublishTo()

Returns

Type Description
DateTime Publish to date on SaleEntity. After this date the event is no longer visible.

GetRating()

Declaration

NSRating GetRating()

Examples

NSSaleEntity thing;
NSRating rating = thing.GetRating();

Returns

Type Description
NSRating The sale rating.

GetReason()

Declaration

NSReason GetReason()

Examples

NSSaleEntity thing;
NSReason reason = thing.GetReason();

Returns

Type Description
NSReason The sale reason.

GetReasonSold()

Declaration

NSReasonSold GetReasonSold()

Examples

NSSaleEntity thing;
NSReasonSold reasonSold = thing.GetReasonSold();

Returns

Type Description
NSReasonSold

GetReasonStalled()

Declaration

NSReasonStalled GetReasonStalled()

Examples

NSSaleEntity thing;
NSReasonStalled reasonStalled = thing.GetReasonStalled();

Returns

Type Description
NSReasonStalled

GetReopenDate()

Declaration

DateTime GetReopenDate()

Examples

NSSaleEntity thing;
DateTime reopenDate = thing.GetReopenDate();

Returns

Type Description
DateTime Date the sale is to be reopened; valid only for status=stalled. Not necessarily the same as the nextDueDate.

GetSaledate()

Declaration

DateTime GetSaledate()

Examples

NSSaleEntity thing;
DateTime saledate = thing.GetSaledate();

Returns

Type Description
DateTime (expected / lost / won) sales date.

GetSaleId()

Declaration

Integer GetSaleId()

Examples

NSSaleEntity thing;
Integer saleId = thing.GetSaleId();

Returns

Type Description
Integer Primary key.

GetSaleStakeholders()

Declaration

NSSaleStakeholder[] GetSaleStakeholders()

Examples

NSSaleEntity thing;
NSSaleStakeholder[] saleStakeholders = thing.GetSaleStakeholders();

Returns

Type Description
NSSaleStakeholder[]

GetSaleText()

Declaration

String GetSaleText()

Examples

NSSaleEntity thing;
String saleText = thing.GetSaleText();

Returns

Type Description
String Text describing the sale.

GetSaleType()

Declaration

NSSaleType GetSaleType()

Examples

NSSaleEntity thing;
NSSaleType saleType = thing.GetSaleType();

Returns

Type Description
NSSaleType

GetSource()

Declaration

NSSource GetSource()

Examples

NSSaleEntity thing;
NSSource source = thing.GetSource();

Returns

Type Description
NSSource The sale source.

GetStatus()

Declaration

Integer GetStatus()

Examples

NSSaleEntity thing;
Integer status = thing.GetStatus();

Returns

Type Description
Integer The state of the Sale (Open, Sold, Lost, Stalled). See <xref href="CRMScript.NetServer.SaleStatus" data-throw-if-not-resolved="false"></xref>.

GetUpdatedBy()

Declaration

NSAssociate GetUpdatedBy()

Examples

NSSaleEntity thing;
NSAssociate updatedBy = thing.GetUpdatedBy();

Returns

Type Description
NSAssociate Who updated the sale.

GetUpdatedDate()

Declaration

DateTime GetUpdatedDate()

Examples

NSSaleEntity thing;
DateTime updatedDate = thing.GetUpdatedDate();

Returns

Type Description
DateTime Last updated.

GetUserDefinedFields()

Gets the user-defined fields on the SaleEntity as a map.

Declaration

Map GetUserDefinedFields()

Examples

NSSaleEntity thing;
Map fields = thing.GetUserDefinedFields();
String oldValue = fields.get("SuperOffice:1");
fields.insert("SuperOffice:1", "NewValue");
for (fields.first(); !fields.eof(); fields.next())
  printLine(fields.getKey() + ":  " + fields.getVal());

Returns

Type Description
Map

GetVisibleFor()

Returns the user groups and/or users the SaleEntity item is visible for.

Declaration

NSVisibleFor[] GetVisibleFor()

Examples

NSSaleEntity thing;
NSVisibleFor[] visibleFor = thing.GetVisibleFor();

Returns

Type Description
NSVisibleFor[]

SetActiveErpLinks(Integer)

Declaration

Void SetActiveErpLinks(Integer activeErpLinks)

Examples

NSSaleEntity thing;
Integer activeErpLinks;
thing.SetActiveErpLinks(activeErpLinks);

Parameters

Type Name Description
Integer activeErpLinks The number of active ERP links.

Returns

Type Description
Void

SetActiveLinks(Integer)

Declaration

Void SetActiveLinks(Integer activeLinks)

Examples

NSSaleEntity thing;
Integer activeLinks;
thing.SetActiveLinks(activeLinks);

Parameters

Type Name Description
Integer activeLinks Number of active links to sale, document, appointment.

Returns

Type Description
Void

SetAmount(Float)

Declaration

Void SetAmount(Float amount)

Examples

NSSaleEntity thing;
Float amount;
thing.SetAmount(amount);

Parameters

Type Name Description
Float amount Total sale amount.

Returns

Type Description
Void

SetAppointment(NSAppointment)

Declaration

Void SetAppointment(NSAppointment appointment)

Examples

NSSaleEntity thing;
NSAppointment appointment;
thing.SetAppointment(appointment);

Parameters

Type Name Description
NSAppointment appointment

Returns

Type Description
Void

SetAssociate(NSAssociate)

Declaration

Void SetAssociate(NSAssociate associate)

Examples

NSSaleEntity thing;
NSAssociate associate;
thing.SetAssociate(associate);

Parameters

Type Name Description
NSAssociate associate The sale owner.

Returns

Type Description
Void

SetCompetitor(NSCompetitor)

Declaration

Void SetCompetitor(NSCompetitor competitor)

Examples

NSSaleEntity thing;
NSCompetitor competitor;
thing.SetCompetitor(competitor);

Parameters

Type Name Description
NSCompetitor competitor List of all possible competitors.

Returns

Type Description
Void

SetCompleted(Integer)

Declaration

Void SetCompleted(Integer completed)

Examples

NSSaleEntity thing;
Integer completed;
thing.SetCompleted(completed);

Parameters

Type Name Description
Integer completed The Sale completed state.

Returns

Type Description
Void

SetContact(NSContact)

Declaration

Void SetContact(NSContact contact)

Examples

NSSaleEntity thing;
NSContact contact;
thing.SetContact(contact);

Parameters

Type Name Description
NSContact contact The contact associated with the sale. It may also be 0 if no contact is associated with the sale.

Returns

Type Description
Void

SetCreatedBy(NSAssociate)

Declaration

Void SetCreatedBy(NSAssociate createdBy)

Examples

NSSaleEntity thing;
NSAssociate createdBy;
thing.SetCreatedBy(createdBy);

Parameters

Type Name Description
NSAssociate createdBy Who created to sale.

Returns

Type Description
Void

SetCreatedDate(DateTime)

Registered date

Declaration

Void SetCreatedDate(DateTime createdDate)

Examples

NSSaleEntity thing;
DateTime createdDate;
thing.SetCreatedDate(createdDate);

Parameters

Type Name Description
DateTime createdDate Registered date.

Returns

Type Description
Void

SetCredited(NSCredited)

Declaration

Void SetCredited(NSCredited credited)

Examples

NSSaleEntity thing;
NSCredited credited;
thing.SetCredited(credited);

Parameters

Type Name Description
NSCredited credited List of who is to be credited for the sale.

Returns

Type Description
Void

SetCurrency(NSCurrency)

Declaration

Void SetCurrency(NSCurrency currency)

Examples

NSSaleEntity thing;
NSCurrency currency;
thing.SetCurrency(currency);

Parameters

Type Name Description
NSCurrency currency The currency the sale object was sold in.

Returns

Type Description
Void

SetCustomFields(Map)

Sets the user-defined and extra fields on a SaleEntity with a map.

Declaration

Void SetCustomFields(Map udefs)

Examples

NSSaleEntity thing;
Map udefs;
udefs["SuperOffice:1"] = "[I:123]";
udefs["SuperOffice:1"] = "123"; // this will also work, but beware of decimal point variations in different languages
udefs["custom.progid"] = "foobar";
udefs["x_foo"] = "foobar";
udefs["x_bar"] = "456"; // List item id
thing.SetCustomFields(udefs);

Parameters

Type Name Description
Map udefs

Returns

Type Description
Void

SetEarning(Float)

Declaration

Void SetEarning(Float earning)

Examples

NSSaleEntity thing;
Float earning;
thing.SetEarning(earning);

Parameters

Type Name Description
Float earning Earning on sale.

Returns

Type Description
Void

SetEarningPercent(Float)

Declaration

Void SetEarningPercent(Float earningPercent)

Examples

NSSaleEntity thing;
Float earningPercent;
thing.SetEarningPercent(earningPercent);

Parameters

Type Name Description
Float earningPercent Earning as percent of total.

Returns

Type Description
Void

SetExtraFields(Map)

Sets the extra field values on SaleEntity with a map.

Declaration

Void SetExtraFields(Map extras)

Examples

NSSaleEntity thing;
Map extras;
extras["SuperOffice:1"] = "[I:123]";
extras["SuperOffice:1"] = "123"; // this will also work, but beware of decimal point variations in different languages
extras["custom.progid"] = "foobar";
thing.SetExtraFields(extras);

Parameters

Type Name Description
Map extras

Returns

Type Description
Void

SetHeading(String)

Declaration

Void SetHeading(String heading)

Examples

NSSaleEntity thing;
String heading;
thing.SetHeading(heading);

Parameters

Type Name Description
String heading Sale heading (short description?).

Returns

Type Description
Void

SetIsPublished(Bool)

Sets the visibility of the entity

Declaration

Void SetIsPublished(Bool isPublished)

Parameters

Type Name Description
Bool isPublished Should this SaleEntity be published and visible to strangers?

Returns

Type Description
Void

SetLinks(NSLink[])

Declaration

Void SetLinks(NSLink[] links)

Examples

NSSaleEntity thing;
NSLink[] links;
thing.SetLinks(links);

Parameters

Type Name Description
NSLink[] links List of all elements linked to the sale.

Returns

Type Description
Void

SetNextDueDate(DateTime)

Maintained by the system, but very convenient for searching.

Declaration

Void SetNextDueDate(DateTime nextDueDate)

Examples

NSSaleEntity thing;
DateTime nextDueDate;
thing.SetNextDueDate(nextDueDate);

Parameters

Type Name Description
DateTime nextDueDate Next due date, this is a de-normalization of 'closest future activity date, or most recent if no future activities'.

Returns

Type Description
Void

SetNumber(String)

Declaration

Void SetNumber(String number)

Examples

NSSaleEntity thing;
String number;
thing.SetNumber(number);

Parameters

Type Name Description
String number Alphanumeric user field.

Returns

Type Description
Void

SetPerson(NSPerson)

A sale may also be connected to a person. This must be a contact person registered on the current contact. This does not mean that a person is required.

Declaration

Void SetPerson(NSPerson person)

Examples

NSSaleEntity thing;
NSPerson person;
thing.SetPerson(person);

Parameters

Type Name Description
NSPerson person

Returns

Type Description
Void

SetPostit(String)

Declaration

Void SetPostit(String postit)

Examples

NSSaleEntity thing;
String postit;
thing.SetPostit(postit);

Parameters

Type Name Description
String postit The actual text, max 2047 significant characters even though it is stored as a larger data type on some databases.

Returns

Type Description
Void

SetProbability(Integer)

Declaration

Void SetProbability(Integer probability)

Examples

NSSaleEntity thing;
Integer probability;
thing.SetProbability(probability);

Parameters

Type Name Description
Integer probability Actual probability, may differ from the one in the list.

Returns

Type Description
Void

SetProject(NSProject)

A sale may also be connected to a project, so you see the sale both on the company card, and on the project card. This does not mean that a project is required.

Declaration

Void SetProject(NSProject project)

Examples

NSSaleEntity thing;
NSProject project;
thing.SetProject(project);

Parameters

Type Name Description
NSProject project

Returns

Type Description
Void

SetPublishEventDate(DateTime)

Declaration

Void SetPublishEventDate(DateTime publishDate)

Parameters

Type Name Description
DateTime publishDate Publish event date on SaleEntity.

Returns

Type Description
Void

SetPublishFrom(DateTime)

Sets the publish from date on a SaleEntity.

Declaration

Void SetPublishFrom(DateTime publishFrom)

Parameters

Type Name Description
DateTime publishFrom

Returns

Type Description
Void

SetPublishTo(DateTime)

Sets the publish to date on SaleEntity.

Declaration

Void SetPublishTo(DateTime publishTo)

Parameters

Type Name Description
DateTime publishTo After this date the event is no longer visible.

Returns

Type Description
Void

SetRating(NSRating)

Declaration

Void SetRating(NSRating rating)

Examples

NSSaleEntity thing;
NSRating rating;
thing.SetRating(rating);

Parameters

Type Name Description
NSRating rating The sale rating.

Returns

Type Description
Void

SetReason(NSReason)

Declaration

Void SetReason(NSReason reason)

Examples

NSSaleEntity thing;
NSReason reason;
thing.SetReason(reason);

Parameters

Type Name Description
NSReason reason The sale reason.

Returns

Type Description
Void

SetReasonSold(NSReasonSold)

Declaration

Void SetReasonSold(NSReasonSold reasonSold)

Examples

NSSaleEntity thing;
NSReasonSold reasonSold;
thing.SetReasonSold(reasonSold);

Parameters

Type Name Description
NSReasonSold reasonSold

Returns

Type Description
Void

SetReasonStalled(NSReasonStalled)

Declaration

Void SetReasonStalled(NSReasonStalled reasonStalled)

Examples

NSSaleEntity thing;
NSReasonStalled reasonStalled;
thing.SetReasonStalled(reasonStalled);

Parameters

Type Name Description
NSReasonStalled reasonStalled

Returns

Type Description
Void

SetReopenDate(DateTime)

Declaration

Void SetReopenDate(DateTime reopenDate)

Examples

NSSaleEntity thing;
DateTime reopenDate;
thing.SetReopenDate(reopenDate);

Parameters

Type Name Description
DateTime reopenDate Date the sale is to be reopened; valid only for status=stalled. Not necessarily the same as the nextDueDate.

Returns

Type Description
Void

SetSaledate(DateTime)

Declaration

Void SetSaledate(DateTime saledate)

Examples

NSSaleEntity thing;
DateTime saledate;
thing.SetSaledate(saledate);

Parameters

Type Name Description
DateTime saledate (expected / lost / won) sales date.

Returns

Type Description
Void

SetSaleId(Integer)

Declaration

Void SetSaleId(Integer saleId)

Examples

NSSaleEntity thing;
Integer saleId;
thing.SetSaleId(saleId);

Parameters

Type Name Description
Integer saleId Primary key.

Returns

Type Description
Void

SetSaleStakeholders(NSSaleStakeholder[])

Declaration

Void SetSaleStakeholders(NSSaleStakeholder[] saleStakeholders)

Examples

NSSaleEntity thing;
NSSaleStakeholder[] saleStakeholders;
thing.SetSaleStakeholders(saleStakeholders);

Parameters

Type Name Description
NSSaleStakeholder[] saleStakeholders

Returns

Type Description
Void

SetSaleText(String)

Declaration

Void SetSaleText(String saleText)

Examples

NSSaleEntity thing;
String saleText;
thing.SetSaleText(saleText);

Parameters

Type Name Description
String saleText Text describing the sale.

Returns

Type Description
Void

SetSaleType(NSSaleType)

Declaration

Void SetSaleType(NSSaleType saleType)

Examples

NSSaleEntity thing;
NSSaleType saleType;
thing.SetSaleType(saleType);

Parameters

Type Name Description
NSSaleType saleType

Returns

Type Description
Void

SetSource(NSSource)

Declaration

Void SetSource(NSSource source)

Examples

NSSaleEntity thing;
NSSource source;
thing.SetSource(source);

Parameters

Type Name Description
NSSource source The sale source.

Returns

Type Description
Void

SetStatus(Integer)

Declaration

Void SetStatus(Integer status)

Examples

NSSaleEntity thing;
Integer status;
thing.SetStatus(status);

Parameters

Type Name Description
Integer status The state of the Sale (Open,Sold,Lost,Stalled). See <xref href="CRMScript.NetServer.SaleStatus" data-throw-if-not-resolved="false"></xref>.

Returns

Type Description
Void

SetUpdatedBy(NSAssociate)

Declaration

Void SetUpdatedBy(NSAssociate updatedBy)

Examples

NSSaleEntity thing;
NSAssociate updatedBy;
thing.SetUpdatedBy(updatedBy);

Parameters

Type Name Description
NSAssociate updatedBy Who updated the sale.

Returns

Type Description
Void

SetUpdatedDate(DateTime)

Declaration

Void SetUpdatedDate(DateTime updatedDate)

Examples

NSSaleEntity thing;
DateTime updatedDate;
thing.SetUpdatedDate(updatedDate);

Parameters

Type Name Description
DateTime updatedDate Last updated.

Returns

Type Description
Void

SetUserDefinedFields(Map)

Sets the user-defined fields on the SaleEntity as a map.

Declaration

Void SetUserDefinedFields(Map udefs)

Examples

NSSaleEntity thing;
Map udefs;
udefs["SuperOffice:1"] = "[I:123]";
udefs["SuperOffice:1"] = "123"; // this will also work, but beware of decimal point variations in different languages
udefs["custom.progid"] = "foobar";
thing.SetUserDefinedFields(udefs);

Parameters

Type Name Description
Map udefs

Returns

Type Description
Void

SetVisibleFor(NSVisibleFor[])

Sets the user groups and/or users the SaleEntity item is visible for.

Declaration

Void SetVisibleFor(NSVisibleFor[] visibleFor)

Examples

NSSaleEntity thing;
NSVisibleFor[] visibleFor = thing.GetVisibleFor();
visibleFor[0].SetVisiblity(1);  // usergroup
visibleFor[0].SetVisibleId(123); // usergroup id
thing.SetVisibleFor(visibleFor);

Parameters

Type Name Description
NSVisibleFor[] visibleFor

Returns

Type Description
Void