ServiceOder Open API throw error while using external ID

Mythili Searn
Kilo Contributor

I am using Service Order Open API to create service order. I am using the example payload given in servicenow document. I have just removed the sys_id and updated them with external ID. External ID for Service Specification, Place, Account and Contact. But I get error for Account and Place. After providing sys_id for these 2, order is getting created. Only service specification and Contact is getting mapped with external id. 

How to override the Account and Place validation/mapping? Anybody done custom fields for mapping additional parameters, which are not in the example?

Below is error message I get while using external ID. 

{
  "code": 23,
  "reason": "Missing body field",
  "message": "Missing body field",
  "details": [
    {
      "message": "Invalid payload: Customer Account does not exist",
      "datapath": "/relatedParty[1]/"
    },
    {
      "message": "Invalid payload: The place doesn't exist in the system",
      "location": "serviceOrderItem[0]:200south"
    }
  ]
}
1 ACCEPTED SOLUTION

Shubham44
ServiceNow Employee
ServiceNow Employee

Please let me know if you have any more queries else please mark the response helpful and correct

View solution in original post

10 REPLIES 10

hi Mythili,

For Service specification , this is not getting extended from CSM module so you won't see the sn_ind_tsm_orm_external_id . The classes/tables extending from CSM tables would have tsm in the name else it will be tmt.

 

As you have mentioned that the issue is resolved now so please mark the response helpful and correct

 

 

 

 

Shubham44
ServiceNow Employee
ServiceNow Employee

hi Kailash,
The account is mandatory and as a best practice from our telecom product perspective we encourage the use of external id's but that need to be placed in the respective tables.

Please mark the response helpful as appropriate.

Shubham44
ServiceNow Employee
ServiceNow Employee

Please let me know if you have any more queries else please mark the response helpful and correct

Hi @Shubham44 

I have a business requirement to automatically create a customer account in ServiceNow from the incoming payload, if that customer account doesn't already exist in the system. Is this possible? If so, do you have any guidance on how to accomplish this?

Right now if the customer account doesn't exist, I'm thrown this error message: 

 

cnharris1_0-1699311028896.png

 


Best regards,

cnharris1

Hi @cnharris1 

 

You can refer to productorderprocessor SI for this customizations.

the method responsible for this customer account object is ' validateRelatedPartyObj', please override this method to validate the business logic if account exists in systems or not. If it does, use same otherwise create one and use it.

SI - ProductOrderProcessor

Method - validateRelatedPartyObj

 

Hope, this helps you achieve the requirement.