Solved

Help with Success Plan Creation API JSON

  • 12 October 2022
  • 6 replies
  • 119 views

Badge

Hi! I’m looking for help with my JSON on a Success Plan Creation API external action. I am attempting to create a Success Plan that is linked to a Relationship and where I populate a lookup field to a custom object. I am receiving an error attempting to create that says,

 

“Please enter valid JSON and char limit should not exceed 10,000.”

 

I know I have not exceeded the char limit. I copied/pasted the original JSON template from the Support website, made edits in Notepad++, and then copied/pasted back into the Payload for an external action. When I put this into a JSON validator website, it is showing many errors, but none that would help in fixing the issues.

 

My JSON is as follows:

{
"requests": [
{
"record": {
"referenceId": "1",
"Name": "{{SPName}}",
"SFDCID": "{{CompanySFDCID}}",
"OwnerEmail": "{{SPOwnerEmail}}",
"DueDate": "{{SPDueDate}}",
"SuccessPlanType": "Digital Solution Onboarding",
"status": "Active",
"Templates": [
"Phase 1: Digital Solution Sale"
],
"RelationshipID": "{{SPRelationshipID}}",
"Onboarding_Data_Entry_Record__gc": "{{DODEGSID}},
}
}
],
"lookups": {
"OwnerId": {
"fields": {
"OwnerEmail": "Email"
},
"lookupField": "Gsid",
"objectName": "gsuser",
"multiMatchOption": "FIRSTMATCH",
"onNoMatch": "ERROR"
},
"CompanyId": {
"fields": {
"SFDCID": "SfdcAccountId"
},
"lookupField": "Gsid",
"objectName": "company",
"multiMatchOption": "FIRSTMATCH",
"onNoMatch": "ERROR"
},
"RelationshipId": {
"fields": {
"RelationshipID": "Gsid"
},
"lookupField": "Gsid",
"objectName": "Relationship",
"multiMatchOption": "FIRSTMATCH",
"onNoMatch": "ERROR"
},
"Onboarding_Data_Entry_Record__gc": {
"fields": {
"DODEGSID": "Gsid"
},
"lookupField": "Gsid",
"objectName": "Digital_Onboarding_Data_Entry__gc",
"multiMatchOption": "FIRSTMATCH",
"onNoMatch": "ERROR"
},
}

Please help if you can!

 

Thanks,

David Person

icon

Best answer by peter_robson 12 October 2022, 18:53

View original

6 replies

Badge

I’ve been told by someone that a @peter_robson may be able to help? Thanks in advance if you are able! I’m very much an API/JSON newb.

Badge +3

Hi David,

Your JSON is almost correct. There were a couple of syntax errors. I also find that when the “Templates” attribute is used, it needs to be added as the last item in the list. Please try this …

{
"requests": [
{
"record": {
"referenceId": "1",
"Name": "{{SPName}}",
"SFDCID": "{{CompanySFDCID}}",
"OwnerEmail": "{{SPOwnerEmail}}",
"DueDate": "{{SPDueDate}}",
"SuccessPlanType": "Digital Solution Onboarding",
"status": "Active",
"RelationshipID": "{{SPRelationshipID}}",
"Onboarding_Data_Entry_Record__gc": "{{DODEGSID}}",
"Templates": [
"Phase 1: Digital Solution Sale"
]
}
}
],
"lookups": {
"OwnerId": {
"fields": {
"OwnerEmail": "Email"
},
"lookupField": "Gsid",
"objectName": "gsuser",
"multiMatchOption": "FIRSTMATCH",
"onNoMatch": "ERROR"
},
"CompanyId": {
"fields": {
"SFDCID": "SfdcAccountId"
},
"lookupField": "Gsid",
"objectName": "company",
"multiMatchOption": "FIRSTMATCH",
"onNoMatch": "ERROR"
},
"RelationshipId": {
"fields": {
"RelationshipID": "Gsid"
},
"lookupField": "Gsid",
"objectName": "Relationship",
"multiMatchOption": "FIRSTMATCH",
"onNoMatch": "ERROR"
},
"Onboarding_Data_Entry_Record__gc": {
"fields": {
"DODEGSID": "Gsid"
},
"lookupField": "Gsid",
"objectName": "Digital_Onboarding_Data_Entry__gc",
"multiMatchOption": "FIRSTMATCH",
"onNoMatch": "ERROR"
}
}
}

 

Badge

Hi @peter_robson ,

I finally got around to testing this as an External Action, but I have received the following error:

{
"result": false,
"errorCode": "COCKPIT_9703",
"errorDesc": "Following lookup field(s) have invalid filter configuration to resolve - RelationshipId -> Relationship : Gsid, Onboarding_Data_Entry_Record__gc -> Digital_Onboarding_Data_Entry__gc : Gsid",
"requestId": "78a9cc7e-83d0-4f68-b82d-6627d2a8ab48",
"data": {},
"message": null
}

Any thoughts on how to resolve this?

Once again, thanks in advance.

 

Thanks,

David

Badge +3

Hi David,

Your mappings are incorrect. 

You can’t use the actual field names in your “record” fields when using a lookup ... They need to be aliases. The “RelationshipID" and "Onboarding_Data_Entry_Record__gc" values are incorrect. Try this in your config. Admittedly, I don’t know your schema, so I am guessing the config for your “DODEGSID” mapping.

{
"requests": [
{
"record": {
"referenceId": "1",
"Name": "{{SPName}}",
"SFDCID": "{{CompanySFDCID}}",
"OwnerEmail": "{{SPOwnerEmail}}",
"DueDate": "{{SPDueDate}}",
"SuccessPlanType": "Digital Solution Onboarding",
"status": "Active",
"RelID": "{{SPRelationshipID}}",
"DODEGSID": "{{DODEGSID}}",
"Templates": [
"Phase 1: Digital Solution Sale"
]
}
}
],
"lookups": {
"OwnerId": {
"fields": {
"OwnerEmail": "Email"
},
"lookupField": "Gsid",
"objectName": "gsuser",
"multiMatchOption": "FIRSTMATCH",
"onNoMatch": "ERROR"
},
"CompanyId": {
"fields": {
"SFDCID": "SfdcAccountId"
},
"lookupField": "Gsid",
"objectName": "company",
"multiMatchOption": "FIRSTMATCH",
"onNoMatch": "ERROR"
},
"RelationshipId": {
"fields": {
"RelID": "Gsid"
},
"lookupField": "Gsid",
"objectName": "Relationship",
"multiMatchOption": "FIRSTMATCH",
"onNoMatch": "ERROR"
},
"Onboarding_Data_Entry_Record__gc": {
"fields": {
"DODEGSID": "Gsid"
},
"lookupField": "Gsid",
"objectName": "Digital_Onboarding_Data_Entry__gc",
"multiMatchOption": "FIRSTMATCH",
"onNoMatch": "ERROR"
}
}
}

 

Userlevel 2
Badge +4

@bytor104 Can you please guide on the end point url used !!I am receiving unauthorized error on testing the connection in actions

 

Userlevel 5
Badge +1

They list out Endpoint URLs on this page.

 

 

https://support.gainsight.com/gainsight_nxt/Success_Plans/Success_Plan_API_Documentation/Success_Plan_APIs

Reply