Pop coming twice in Portal.

Kruthik M Shiva
Tera Contributor

Hi All,

I have one record producer and for that record producer table I have written on change client script if they change field value the pop should generate. But i am facing issue in portal view has pop up is triggering twice in portal view whereas in native its coming properly only once. What could be the possible issue and how do I fix this. If anyone has pointers on this, please do share. PFB attached screenshot for reference.
Thanks in advance,
Kruthik Shivaprasad

1 ACCEPTED SOLUTION

Try this:

 

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
    if (isLoading || newValue === '' || newValue == oldValue) {
        return;
    }
 
    if (g_form.isNewRecord()) {
        // do nothing, this code only applies to existing records
    } 
else {
 
        var name = oldValue;
        var sysID = g_form.getUniqueValue();
var iaowner = g_form.getValue('ia_owner');
        g_form.addErrorMessage("Making any changes to the Intellectual Asset name will re-trigger the Marketing and Trademark approvals. " + link + " to re-trigger the Brandname Clearance");
        if (newValue != oldValue) {
            g_form.setValue("intellectual_asset_name", oldValue);
        }
    }
}
If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.
Regards,Sushant Malsure

View solution in original post

6 REPLIES 6

sushantmalsure
Mega Sage
Mega Sage

@Kruthik M Shiva  can you share the script from where this pop up is coming.

 

 

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 ,
This is the script written.

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
    if (isLoading || newValue === '') {
        return;
    }
 
    if (g_form.isNewRecord()) {
        // do nothing, this code only applies to existing records
    } 
else {
 
        var name = oldValue;
        var sysID = g_form.getUniqueValue();
var iaowner = g_form.getValue('ia_owner');
        g_form.addErrorMessage("Making any changes to the Intellectual Asset name will re-trigger the Marketing and Trademark approvals. " + link + " to re-trigger the Brandname Clearance");
        if (newValue != oldValue) {
            g_form.setValue("intellectual_asset_name", oldValue);
        }
    }
}
Please tell what is the issue and how do i fix it.
Thank you.

sushantmalsure
Mega Sage
Mega Sage

You should have below at beginning of onChange() script:

 

if(newValue == oldValue){
return;
}
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 ,
Can you please tell where exactly in my code i need to change?