Use Case:
To change Account Type from Prospect to Customer via a button click, and Customer value itself maybe not a picklist in the account type.
Solution:
Create a custom button in Account object. Here we go:
- Navigate to Setup | Customize | Accounts | Buttons, Links, and Actions
- Click New Button or Link, select Detail Page Button in Display Type, and in Behavior select Execute JavaScript
- Paste script below
- Add custom button created to the Account page layout.
- Done - simple ?
{!REQUIRESCRIPT("/soap/ajax/29.0/connection.js")}
var AccObj = new sforce.SObject("Account");
AccObj.Id = '{!Account.Id}';
AccObj.Type = 'Customer';
var result = sforce.connection.update([AccObj]);
location.reload(true);
Further tweak, you also can differentiate Customer record type with Prospect record type, so in the script above, add one line to change Account Record Type with Customer Record Type Id, then assign different Page Layout for Customer.
No comments:
Post a Comment