Affected CI add button on change request form

Zubair Alam2
Tera Contributor

How can we display the "Add" button on change request Affected CI related List tab when the form is in "Assess" state?
Be default, this is only available when the state is "New". 
All help is appreciated. Thanks.

ZubairAlam2_0-1736953292396.png

 

2 ACCEPTED SOLUTIONS

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @Zubair Alam2 

I disagree with this requirement, and here’s why:

When a change moves to the "Assess" state, it signifies readiness for approval. Adding a CI at this stage could create issues. For instance, if five approvals are required in the "Assess" state and two have already been granted, introducing a new CI means the two approvers didn’t evaluate the change considering the updated CI. This undermines the integrity of their approval.

Additionally, there may be workflows triggered based on the affected CIs, which might not execute correctly due to the late addition.

I recommend reconsidering this approach before implementing any changes.

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

View solution in original post

@Zubair Alam2 

As per new community feature you can mark multiple responses as correct.

If my response helped please mark it correct as well that it benefits future readers.

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

View solution in original post

8 REPLIES 8

Community Alums
Not applicable

Ankur Bawiskar
Tera Patron
Tera Patron

@Zubair Alam2 

you will have to check this function "canAddCI" within script include "ChangeProposed"

line 47 tells it to be shown only in New state

UI Action: https://instanceName.service-now.com/nav_to.do?uri=sys_ui_action.do?sys_id=77688cfe6f35f100e5f2b3312e3ee4e6

Remember this is the UI action condition on that button so please ensure other conditions are also satisfied

RP.isManyToMany() && (new ChangeProposed(parent)).canAddCI() && current.canCreate() && parent.active == true && gs.getProperty('com.snc.task.associate_ci').indexOf(parent.sys_class_name) > -1

AnkurBawiskar_0-1736954506863.png

 

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
Tera Patron
Tera Patron

@Zubair Alam2 

I updated the function as this and it started showing in Assess

I added OR condition

canAddCI: function() {
        // If it's not a change task, return true and let other conditions decide
        // This has to be done as the Add CI action could be used on all types of tasks
        if (!this._isChangeTask)
            return true;
       
        // If it's a change in the new state, return allow adding of CIs
        if (this._changeRequest.isNew() || this._changeRequest.isAssess())
            return true;
       
       
        if (this._log.atLevel(GSLog.DEBUG))
            this._log.debug("[canAddCI] Cannot add CIs to Change Request " + this._grChgReq.number + ":" + this._grChgReq.getUniqueValue());
       
        // In all other cases, don't allow addition of CIs
        return false;
    },

Output: Add button visible on Assess state

AnkurBawiskar_0-1736954919743.png

 

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

@Zubair Alam2 

Hope you are doing good.

Did my reply answer your question?

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