Set "Parent" field on new change_request form from the RITM number using Create change UI Action

Florian CHAMOI1
Giga Expert

Hello everyone,

I slightly adapted the OOB "Create change" UI action on sc_req_item so there is now 2 buttons on the form:

- Create normal change : Which is working fine by creating a change and linking correctly the RITM number on the Parent field of the Normal change.

- Create standard change: Which is correctly redirecting on the Standard Change Template Library, but doesn't populate the Parent field with the RITM number.

I thought this would be simple enough as it works perfectly from the "New" button of the Change Requests Related list, which I cannot use since my client removed the change interceptor (Or maybe I can and I missed something ? 🙂 ).

Unfortunately, I can't seem to find how to make the link between the two records work and haven't found anything helping me on the community.

My UI action for the standard change is the following:

find_real_file.png

I would really appreciate it if you could give me at least some directions, thanks a lot in advance !

Florian

6 REPLIES 6

Archana Reddy2
Tera Guru

Hi Florian,

As you said, the URL you have given will take you to Standard Change Template Library, which is not a form that contains Parent field or any other field. That might be the reason.

Also, the below thread may help you. FYI, std_change_record_producer_list.do is where you can find the templates related to Standard Changes.

Useful thread

Hope this helps.

Mark the answer as Correct/Helpful based on its impact.

Thanks,

Archana

The below one may also help you as reference.

UI Action:

var template = new GlideRecord('std_change_record_producer');
if(template.get('563504cc47410200e90d87e8dee490e2')) //sysId of template that you wish to have
{
var chg = new GlideRecord('change_request');
chg.initialize();
 chg.applyTemplate(template.name);
 chg.std_change_producer_version = template.current_version;
 chg.type = 'standard';
chg.parent = current.sys_id;
chg.insert();
  }

Please let me know if you need any help of this.

Thanks,

Archana

Florian CHAMOI1
Giga Expert

Hello Archana,

 

Many thanks for your replies 🙂

About the fact that the url it takes me is the Standard Change Template Library and does not contain the Parent field: I understand and it's actualy quite logical. I was hoping that the behavior would be the same as the "New" button on the change_request Related list. This New button takes you to the change interceptor, then the standard change catalog if you select the standard change on the interceptor, and you still have the parent field populated correctly.

However I looked at this button code, and the code doesn't look at all at something I could reproduce in a UI action 😛

Your script is promising, I will test it in my instance but the fact that I have to specify the template is a problem. I'd like the user to be able to chose the standard template and still have the parent field populated afterward.

Thanks again !

Florian

 

For the user to be able to select the template, I believe we should have a field (on sc_req_item) that allows the user to select the template and based on his/her input, we can do the next.

Thanks