You need to sign in to do that
Don't have an account?
b.gonzalez
Custom Button on Case object not updating record?
I have a custom button on the Case object. However when the users clicks on the button. The record is not updating.
{!REQUIRESCRIPT("/soap/ajax/29.0/connection.js")} if("{!Case.Status}" != "Closed"){ var record = new sforce.SObject("Case"); record.Id = "{!Case.Id}"; record.Status= 'Closed'; record.Product_Family__c= 'Unknown'; record.Product_Model__c= 'Unknown'; record.Problem_Code__c= 'Inquiry - Non-Technical'; record.Resolution_Code__c= 'Spam'; var result = sforce.connection.update([record]); } // check the result here window.location.reload();
1. Your code looks fine, you might be missing correct api name so try to execute following code with standard field only.
2. Try to run your code in firefox or in chrome with firebug open so that you can see if sfdc is throwing any error.
Thanks,
Himanshu
I update my code to the following and the case record is now updating: However, I need to modify the record to update the Account field (lookup field) on the case record. In addition, I need the Account field to be updated on the contact record as well. Is this possible?
Yes you can update the account lookup field with above values and if you want to update any other value of Account object on the basis of Case object update you can user process builder to achieve the same without writing the code.
Makes sense ?
Thanks,
Himanshu
However, when a user clicks on the custom button on the case: They recieve the following error message:
I am not sure why. Please help!
Beth
Process builder generally throw errors when fields value returns null. i.e. if you have null Account id or Contact id it will throw or any other field so you need to add all null check while creating process.
Kindly check process with a single records where you have all values filled.
Thanks,
Himanshu
I am still receiving the same error. In addition, I recieved the following email error notification:
Sandbox: Unhandled process fault from QLogic Corporation : Spam_Button_on_Case_Object : UPSERT --- UPSERT FAILED --..
Sandbox
Encountered unhandled fault when running process Spam_Button_on_Case_Object/301f00000000boE exception by user/organization: 00Df0000003cHuJ/{4} Source organization: 00D00000000hbaA (null) UPSERT --- UPSERT FAILED --- ERRORS : (FIELD_CUSTOM_VALIDATION_EXCEPTION) <div style="background-color: red; height: 20px; color: white; line-height: 20px;">Duplicates for Account</div><table width="80%" cellspacing="0" cellpadding="0" class="list"><thead class="rich-table-thead"><tr class="headerRow"><th class="headerRow" width="40">Score</th><th class="headerRow">Account Name</th><th class="headerRow">Billing City</th><th class="headerRow">Billing Country</th><th class="headerRow">Account Phone</th><th class="headerRow">Account Number</th></tr></thead><tbody><tr class="dataRow" onfocus="if (window.hiOn){hiOn(this);}" onblur="if (window.hiOff){hiOff(this);}" onmouseout="if (window.hiOff){hiOff(this);}" onmouseover="if (window.hiOn){hiOn(this);}"><td class="dataCell" style="text-align: left; font-weight: normal;">75</td><td class="dataCell" style="text-align: left; font-weight: normal;"><a href="/00180000010CVOvAAO">Unclassified Customer - Minnetonka</a></td><td class="dataCell" style="text-align: left; font-weight: normal;"><a href="/00180000010CVOvAAO"></a></td><td class="dataCell" style="text-align: left; font-weight: normal;"><a href="/00180000010CVOvAAO">United States</a></td><td class="dataCell" style="text-align: left; font-weight: normal;"><a href="/00180000010CVOvAAO"></a></td><td class="dataCell" style="text-align: left; font-weight: normal;"><a href="/00180000010CVOvAAO"></a></td></tr></tbody></table></br> --- for SFDC record with ID : null,
caused by element : FlowRecordUpdate.myRule_1_A1
caused by: UPSERT --- UPSERT FAILED --- ERRORS : (FIELD_CUSTOM_VALIDATION_EXCEPTION) <div style="background-color: red; height: 20px; color: white; line-height: 20px;">Duplicates for Account</div><table width="80%" cellspacing="0" cellpadding="0" class="list"><thead class="rich-table-thead"><tr class="headerRow"><th class="headerRow" width="40">Score</th><th class="headerRow">Account Name</th><th class="headerRow">Billing City</th><th class="headerRow">Billing Country</th><th class="headerRow">Account Phone</th><th class="headerRow">Account Number</th></tr></thead><tbody><tr class="dataRow" onfocus="if (window.hiOn){hiOn(this);}" onblur="if (window.hiOff){hiOff(this);}" onmouseout="if (window.hiOff){hiOff(this);}" onmouseover="if (window.hiOn){hiOn(this);}"><td class="dataCell" style="text-align: left; font-weight: normal;">75</td><td class="dataCell" style="text-align: left; font-weight: normal;"><a href="/00180000010CVOvAAO">Unclassified Customer - Minnetonka</a></td><td class="dataCell" style="text-align: left; font-weight: normal;"><a href="/00180000010CVOvAAO"></a></td><td class="dataCell" style="text-align: left; font-weight: normal;"><a href="/00180000010CVOvAAO">United States</a></td><td class="dataCell" style="text-align: left; font-weight: normal;"><a href="/00180000010CVOvAAO"></a></td><td class="dataCell" style="text-align: left; font-weight: normal;"><a href="/00180000010CVOvAAO"></a></td></tr></tbody></table></br> --- for SFDC record with ID : null,
Salesforce Error ID: 943214442-28408 (1820369309)
Beth
I figured it out. I have Duplicate Checker installed package in my instance. The settings on this package was preventing the button and the process from working.
Beth
I just realized instead of the procss re-associating the contact record to the "Unclassified Customer – Minnetonka' account record. It is overrding the account record the contact is related to and renaming the account to 'Unclassified Customer – Minnetonka' .
Is there a way around this with the Process Builder?
Beth
I think you should check your process for this and add logic to avoid this.
Himanshu