You need to sign in to do that
Don't have an account?
![Erik Laramee Erik Laramee](https://dfc-org-production.my.site.com/img/userprofile/default_profile_45_v2.png)
javascript button triggering validation rule
Hey Folks, I have a validation rule on a field for NOT( ISCHANGED) ). I have a button that is triggering this rule when pressed even though the field has been changed. I can't figure out a way around it. Any ideas? This is the button:
{!REQUIRESCRIPT("/soap/ajax/39.0/connection.js")}
try {
var newRecords = [];
var c = new sforce.SObject("Request_for_Information_RFI__c");
c.id ="{!Request_for_Information_RFI__c.Id}";
c.Submit_RFI__c= true;
c.Approval_Submitted__c= true;
newRecords.push(c);
result = sforce.connection.update(newRecords);
if( result[0].getBoolean( "success" ) ) {
window.location.reload();
}
else {
alert( "An error has occurred. Error:" + result );
}
}
catch( e ) {
alert( "An unexpected error has occurred. Error:" + e );
}
{!REQUIRESCRIPT("/soap/ajax/39.0/connection.js")}
try {
var newRecords = [];
var c = new sforce.SObject("Request_for_Information_RFI__c");
c.id ="{!Request_for_Information_RFI__c.Id}";
c.Submit_RFI__c= true;
c.Approval_Submitted__c= true;
newRecords.push(c);
result = sforce.connection.update(newRecords);
if( result[0].getBoolean( "success" ) ) {
window.location.reload();
}
else {
alert( "An error has occurred. Error:" + result );
}
}
catch( e ) {
alert( "An unexpected error has occurred. Error:" + e );
}
All Answers
Thanks, I will give that a shot. It's in use in our customer portal. If it's a customer portal profile and the record type, it should fire if Field__c is not changed.
AND(
NOT( ISCHANGED( Field__c ) ),
RecordTypeId = "01280000000U9s6",
$User.ProfileId = "00e4C000000YMVM" )