Skip to main content
Solved

Help with Success Plan Creation API JSON

  • October 12, 2022
  • 6 replies
  • 142 views

bytor104
Forum|alt.badge.img+1
  • Contributor ⭐️⭐️⭐️
  • 17 replies

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

Best answer by peter_robson

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"
        }
    }
}

 

View original
Did you find this topic helpful?

6 replies

bytor104
Forum|alt.badge.img+1
  • Author
  • Contributor ⭐️⭐️⭐️
  • 17 replies
  • October 12, 2022

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.


peter_robson
Forum|alt.badge.img+3
  • Gainsight Employee ⭐️
  • 17 replies
  • Answer
  • October 12, 2022

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"
        }
    }
}

 


bytor104
Forum|alt.badge.img+1
  • Author
  • Contributor ⭐️⭐️⭐️
  • 17 replies
  • October 14, 2022

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


peter_robson
Forum|alt.badge.img+3
  • Gainsight Employee ⭐️
  • 17 replies
  • October 17, 2022

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"
        }
    }
}

 


Forum|alt.badge.img+4
  • Helper ⭐️⭐️
  • 33 replies
  • June 14, 2024

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

 


Forum|alt.badge.img+2
  • Expert ⭐️
  • 227 replies
  • June 17, 2024

Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings