The CreatorCon Call for Content is officially open! Get started here.

When does GlideRecord insert/update fail? What kind of logs should I be looking for?

Shibu2
Kilo Expert

I'm trying to insert a record with a particular payload. But the insert/update is failing (No exceptions thrown. Doesn't return a sys_id). Any reasons why the update would fail? Where should I be looking? Data policies? BRs are turned off (serWorkflow(false))

2 REPLIES 2

Michael Jones -
Giga Sage

Without details it is a little difficult to provide advice, but some general things to check:

Check is scope is an issue; if you are in a scoped application trying to access another scoped application (or in some instances Global) then the insert can fail. 

In your script, try putting gs.log() statements at various points and see if you can identify where it might be failing. Pay special attention to areas where you set values based on your payload, to ensure that the values being passed are what you expect. 

Make sure that you are using .initialize() and .insert(). 

On you .insert() you might try using a line like var sys_id = gr.insert(); and see what the result of sys_id is. 

Last, but not least, since you didn't mention how this is being initiated, if this is being done via a REST or SOAP call (or done under a user other than an Admin) make sure that the credentials have the necessary roles to pass all applicable ACLs. 

You might consider posting your script for others to review as we often spot things in detailed review we would miss in a conceptual discussion. 

If this was helpful or correct, please be kind and remember to click appropriately!

Michael Jones - Proud member of the CloudPires team!

 

I hope this helps!
Michael D. Jones
Proud member of the GlideFast Consulting Team!

Mike Sabia1
Tera Expert

I would first look at mandatory fields which the payload is not populating.  

These could be mandatory due to field definitions or data policies.