Skip to content
This repository has been archived by the owner on Apr 7, 2024. It is now read-only.

[pull] master from pgonzaleznetwork:master #25

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions examples/workflowInfoExamples.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,16 @@ let connection = {
};

let entryPoint = {
name:'Account',
id:'Account',
name:'Lead',
id:'Lead',
type:'Object'
}

let soupApi = sfdcSoup(connection,entryPoint);

async function test(){
let workflowInfo = await soupApi.getWorkflowInfo();
console.log(workflowInfo)
}

test();
Expand Down
16 changes: 11 additions & 5 deletions lib/sfdc_apis/workflowToFlow.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function workflowApi(connection,entryPoint,cache){

if(Metadata.formula){

workflowInfo.criteria = Metadata.formula;
workflowInfo.criteria = replaceDoubleQuotes(Metadata.formula);

let parseReq = {
object : entryPoint.id,
Expand Down Expand Up @@ -186,7 +186,7 @@ function workflowApi(connection,entryPoint,cache){
output.hasOutboundMessages = true;
let fields = Array.isArray(metadata.fields) ? metadata.fields : [metadata.fields];
output.fieldsUsedInAction.add(...fields);
output.endpointUrls.add(metadata.endpointUrl);
output.endpointUrls.add(replaceDoubleQuotes(metadata.endpointUrl));
}
else if(action.type == 'FieldUpdate'){

Expand All @@ -201,7 +201,7 @@ function workflowApi(connection,entryPoint,cache){
}

if(metadata.formula){
value = `${metadata.formula} (formula)`;
value = `${replaceDoubleQuotes(metadata.formula)} (formula)`;
}
else if(metadata.literalValue){
value = metadata.literalValue;
Expand All @@ -227,10 +227,10 @@ function workflowApi(connection,entryPoint,cache){

if(recipient.type == 'user'){

output.emailsSentTo.add(recipient.recipient);
output.emailsSentTo.add(replaceDoubleQuotes(recipient.recipient));
}
else if(recipient.type == 'email'){
output.fieldsUsedInAction.add(recipient.field);
output.fieldsUsedInAction.add(replaceDoubleQuotes(recipient.field));
}

})
Expand Down Expand Up @@ -290,6 +290,12 @@ function workflowApi(connection,entryPoint,cache){

}

//because this'll be used in an excel file, double quotes
//must be replaced with single quotes
function replaceDoubleQuotes(text){
return text.replace(/"/g, "'");
}

function sheetFormat(workflows,format){

let headers = Object.keys(workflows[0]);
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sfdc-soup",
"version": "18.2.1",
"version": "18.4.0",
"description": "A simple API to view your Salesforce dependencies, powered by HappySoup.io",
"main": "src/index.js",
"scripts": {
Expand Down