Copy Change Request via URL

Ariel Aharon
Giga Guru

Hi!

 

We've got an already worked on UI Action that copies change requests (not OOTB one) and there's this weird bug when we save the copied CR it'll always save it's type as Standard no matter what is the copied CR type is.

 

This is the UI Actions code:

 

 

function OnCopyChangeClick() {
    var url = '';

    url = "now/nav/ui/classic/params/target/change_request.do%3Fsys_id%3D-1%26sysparm_query%3Dchg_model%253d" + g_form.getValue('chg_model') + "%255etype%253d" + g_form.getValue('type') + "&change_id=" + g_form.getUniqueValue();

    open(url, '_blank');
}

 

 

I have tried decoding it and "cleaning" it but something always seem to break, either the fields are populated to the type is showing as Standard ever BEFORE saving the form.

 

Do have any information on how to construct this kind of URI to serve the same purpose?

 

 

3 REPLIES 3

sushantmalsure
Mega Sage
Mega Sage

This part in your URL variable '

sys_id%3D-1

is for creating a new change request (blank CR) and this URL when opened must be opening a new CR with with Standard type as default value.

Is it opening correct change request? or you wanted to create a new change request only ?

If new CR from URL is expected then try to alert the value of  (g_form.getValue('type')) and do check what is the default value for type is.

 

 

'

If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.
Regards,Sushant Malsure

Hi  sushantmalsure,

 

Well the requirement is basically when ever that UI Action is clicked:

1. New window of a new CR record is opened

2. The new CR form with be populated with source CR (from where the UI Action was clicked)

3. When clicking 'Save' the new CR will be saved with pre-populated data

 

Now when is happening is all correct, a new window is opened, and the new record form is populated with source CR but when Clicking save, the CR is saved as Standard no matter what

When you click on UI action and its opening a new change in new window, if you see desired change type selected and after save its changing the type to standard.

Then I believe issue is not with UI action but with something else.

Use system watcher (right click on type field and select watch 'type') before you click save.

This will show you what is changing the type to un-desired choice after submitting the form.

Now there can be many reasons for this to happen as per customisations done .

 

If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.
Regards,Sushant Malsure