I want to add Info message in Portal view.

JVINAY
Tera Contributor

Hi Team.

I want to add Info message in Poral view.

Currently this message showing in platform view 

JVINAY_0-1744789241870.png

But I want to add this message in Portal view also

Condition : This message should remain display until "CAN PROVISION PROD (u_approved_for_production_provisioning) "box  is checked.

 

Can please help me how to achieve this.

Thank you. 

 

 
28 REPLIES 28

@JVINAY 

you should compare newValue

if(newValue.toString() == 'false')

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 ,

I have written below code but not working.

 

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
    if (isLoading || newValue === '') {
        return;
    }

    //Type appropriate comment here, and begin script below
    if (newValue.toString() == 'false') {
        g_form.showFieldMsgge('This request is for production only.  In order to proceed with this production-only request, a Cloud Intake admin will need to check the CAN PROVISION PROD box and click save.', 'info', true);
 
For My requirement 
Can Provision PROD -- False ( Unchecked ) This Info message should appear in the Portal same as Platform view.
In the platform view  Onload client script working well.
kindly help me above code modification.
Thank you.

Hello @JVINAY ,

 

Able to share your onLoad script which works in the platform to help more on the code.


If this solution helped resolve your issue, please consider marking it as helpful or correct.
This will assist others in finding the solution faster and close the thread.

JVINAY
Tera Contributor

Hi @Shree_G ,

Onload Client script Platform view:

 

function onLoad() {

    var EnvironmentsValue = g_form.getValue('u_environments');
    var CanProvProd = g_form.getValue('u_approved_for_production_provisioning');
    var StateValue = g_form.getValue('state');


    if (EnvironmentsValue == '45f9c6b9db9a4f00eed27bedae961953' && CanProvProd == 'false' && StateValue !== '110') {
        //If the requested environment is prod only, and the Can Provision Prod checkbox has not been checked, and the state is not prod readiness, display this message

        g_form.addInfoMessage("This request is for production only.  In order to proceed with this production-only request, a Cloud Intake admin will need to check the CAN PROVISION PROD box and click save.");
    }
}
JVINAY_0-1744799170630.png

 

@JVINAY : Take backup of the script and try below code in the same onLoad script:

 

added -->

g_form.addInfoMessage('u_approved_for_production_provisioning' , 'This request is for production only. In order to proceed with this production-only request, a Cloud Intake admin will need to check the CAN PROVISION PROD box and click save.' , 'info' , true);

 

function onLoad() {

    var EnvironmentsValue = g_form.getValue('u_environments');
    var CanProvProd = g_form.getValue('u_approved_for_production_provisioning');
    var StateValue = g_form.getValue('state');


    if (EnvironmentsValue == '45f9c6b9db9a4f00eed27bedae961953' && CanProvProd == 'false' && StateValue !== '110') {
        //If the requested environment is prod only, and the Can Provision Prod checkbox has not been checked, and the state is not prod readiness, display this message

        g_form.addInfoMessage('u_approved_for_production_provisioning' , 'This request is for production only.  In order to proceed with this production-only request, a Cloud Intake admin will need to check the CAN PROVISION PROD box and click save.' , 'info' , true);
    }
}

If this solution helped resolve your issue, please consider marking it as helpful or correct.
This will assist others in finding the solution faster and close the thread.