DI Jint: Difference between revisions

From Apps for Creatio
No edit summary
No edit summary
 
(13 intermediate revisions by the same user not shown)
Line 1: Line 1:
There are specific commands in the Javascript Engine (JINT) relating to Creatio Only.  
There are specific commands in the Javascript Engine (JINT) relating to Creatio Only.  


# getGUID  
# getGUID - This is used where you have the "Name" value and need the Guid ID. You would use this for an integration where Id's would not map but you could map the Names. Only one result is returned so this depends on the Name value being unique. Otherwise use querydb.
 
   - Parameters (a) COLLECTION (b) FILTER
   - Parameters (a) COLLECTION (b) FILTER
  <nowiki> </nowiki>- returns GUID value
  - returns GUID value
<nowiki> </nowiki>EG
EG
  <nowiki> </nowiki> >var _accInGuid = di.getGUID("AccountIndustry","Business Services");<nowiki>
  <nowiki> >var _accInGuid = di.getGUID("AccountIndustry","Consulting");
</nowiki>  
 
2. getLookup - This is used where you query a collection but need the Name value so a person can read this rather than the Guid value.
  - Parameters (a) COLLECTION (b) GUID
  <nowiki> - returns NAME field value from COLLECTION </nowiki>  
EG
  <nowiki> >var _accInName = di.getLookup("OpportunityStage","c2067b11-0ee0-df11-971b-001d60e938c6"); </nowiki>
 
OR you can also pass in the field (Default is Name)
 
<nowiki> >var _accInName = di.getLookup("OpportunityStage","c2067b11-0ee0-df11-971b-001d60e938c6","Name"); </nowiki>
 


3. var ent=di.getEntityById(ENTITY,ENTITYID)


eg
<nowiki>
var _contact = di.getEntityById("contact","590f5617-49ce-48f1-acbb-0f7de14d38ba")
</nowiki>
This runs EG


# getLookupName
https://test.creatio.com/0/odata/Contact(590f5617-49ce-48f1-acbb-0f7de14d38ba)?$count=true&$top=1
  - Parameters (a) COLLECTION (b) GUID
<nowiki> </nowiki>- returns NAME field value from COLLECTION
<nowiki> </nowiki>EG
<nowiki> </nowiki> >var _accInName = var _accInName = di.getLookup("OpportunityStage","c2067b11-0ee0-df11-971b-001d60e938c6");

Latest revision as of 14:30, 22 February 2026

There are specific commands in the Javascript Engine (JINT) relating to Creatio Only.

  1. getGUID - This is used where you have the "Name" value and need the Guid ID. You would use this for an integration where Id's would not map but you could map the Names. Only one result is returned so this depends on the Name value being unique. Otherwise use querydb.
 - Parameters (a) COLLECTION (b) FILTER
  - returns GUID value

EG

 >var _accInGuid = di.getGUID("AccountIndustry","Consulting");
 

2. getLookup - This is used where you query a collection but need the Name value so a person can read this rather than the Guid value.

  - Parameters (a) COLLECTION (b) GUID
  - returns NAME field value from COLLECTION  

EG

 >var _accInName = di.getLookup("OpportunityStage","c2067b11-0ee0-df11-971b-001d60e938c6"); 

OR you can also pass in the field (Default is Name)

 >var _accInName = di.getLookup("OpportunityStage","c2067b11-0ee0-df11-971b-001d60e938c6","Name"); 


3. var ent=di.getEntityById(ENTITY,ENTITYID)

eg

 
var _contact = di.getEntityById("contact","590f5617-49ce-48f1-acbb-0f7de14d38ba")
  

This runs EG

https://test.creatio.com/0/odata/Contact(590f5617-49ce-48f1-acbb-0f7de14d38ba)?$count=true&$top=1