User Tools

Site Tools


servicenow_salesforce_configuration

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
servicenow_salesforce_configuration [2019/12/04 15:15]
vinhn [Table Map]
servicenow_salesforce_configuration [2020/06/16 17:53] (current)
vinhn [Transform Scripts]
Line 106: Line 106:
 var pspS = new PerspectiumEncryption();​ var pspS = new PerspectiumEncryption();​
 ogr.addQuery("​state",​ "​deferred"​);​ ogr.addQuery("​state",​ "​deferred"​);​
-//replace source.s_nn_c ​with correct variable +//replace source.u_snn_c ​with correct variable 
-ogr.addQuery("​u_attributes",​ '​CONTAINS',​ "​ExternalIdValue="​ + source.u_snn_c);+ogr.addQuery("​u_attributes",​ '​CONTAINS',​ "​ExternalIdValue="​ + source.u_correlation_display_c);
 ogr.queryNoDomain();​ ogr.queryNoDomain();​
 var jsonParser = new JSONParser();​ var jsonParser = new JSONParser();​
  
 while (ogr.next()) { while (ogr.next()) {
-  + var cipher; 
- var names = String(ogr.name).split(".")+ if (ogr.u_attributes.indexOf("cipher=2"​) ​> -1) 
-  + cipher ​= "​2";​ 
- if (names.length != 2 || names[1] != "​update"​){ + else if (ogr.u_attributes.indexOf("​cipher=4"> -1
- continue; + cipher ​"​4"​;
-+
-  +
-  var decoded ​pspS.decryptStringWithCipher(String(ogr.value), ​"​2"​)+
- var newValue = jsonParser.parse(decoded.toString());​ +
- var att = ogr.u_attributes.toString();​ +
-  +
- if (att.indexOf(target.sys_id) < 0) +
- continue;​ +
-  +
- if (names[0] ​== '​Attachment'​ || names[0] == '​CaseComment'​+
-                ogr.name = names[0] + '​.insert';​ +
- newValue.ParentId = source.u_id.toString()+
-        } +
-  +
- else if (names[0] ​== '​Case'​) +
- newValue.Id = source.u_id.toString(); +
- +
  else  else
- continue;+ cipher = "​3"​;
   
- var str JSON.stringify(newValue);​ +    ​var names String(ogr.name).split("."); 
- ogr.value = pspS.encryptStringWithCipher(str, "2"); +    if (names.length != 2 || names[1] != "update") { 
- ogr.u_extra ​= "";​ +        continue
- ogr.state "​ready"​;+    } 
 + 
 +    var decoded = pspS.decryptStringWithCipher(String(ogr.value), cipher); 
 +    var newValue ​jsonParser.parse(decoded.toString());​ 
 +    var att = ogr.u_attributes.toString();​ 
 + 
 +    if (att.indexOf(target.sys_id) < 0) 
 +        continue;
   
- ogr.update();​+    if (names[0] == '​Attachment'​ || names[0] == '​CaseComment'​) { 
 +        ogr.name = names[0] + '​.insert';​ 
 +        newValue.ParentId = source.u_id.toString();​ 
 +    } else if (names[0] == '​Case'​) 
 +        newValue.Id = source.u_id.toString();​ 
 + 
 +    else 
 +        continue; 
 + 
 +    var str = JSON.stringify(newValue);​ 
 +  
 +    ogr.value = pspS.encryptStringWithCipher(str,​ cipher); 
 +    ogr.u_extra = "";​ 
 +    ogr.state = "​ready";​ 
 + 
 +    ​ogr.update();​
 } }
 </​code>​ </​code>​
servicenow_salesforce_configuration.1575501319.txt.gz · Last modified: 2019/12/04 15:15 by vinhn