save as draft functionality not working as expected in catalog item

sln
Tera Contributor

When a catalog request is saved as draft, on the draft record few conditionally dependent variables are hidden even when they are made visible on normal request form and few variable values are cleared. Please let me know if this can be solved without disturbing existing scripts.

14 REPLIES 14

Hi @Ankur Bawiskar, sorry for the delay in response.
As you mentioned that we can ensure that ui policies or client scripts doesn't run in that mode,can you please let me know how to do that.
Also in my client script browser url I can't see edit=draft. In this case, what am I supposed to do. Thanks in advance

@sln 

when you click on view my drafts and click the draft version, it opens up your catalog item and pre-fills your variable information

when this happens did you check what's there in the URL?

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

@Ankur Bawiskar 
Yes, I found it now on draft record browser url. In that case, what am I supposed to do now

@sln 

ensure that your onload catalog client scripts don't run in that case

if(url contains draft){

// don't do anything

}

else{

// your logic

}

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

@Ankur Bawiskar 
Can we also use if(g_form.isnewRecord()). If it's not a new record then return else logic works. Does this work