You need to sign in to do that
Don't have an account?
SquirrelMaster
Button to Verify Fields are populated
I'm trying to create a custom button located on the account.
What I want it to do is verify that the billing street, city, state, and zip are populated and if so, then I want it to set another field entitled Accounting Type to Vendor. If any aren't populated, I want an error to state it needs to be populated before it will switch to vendor.
I'm new to coding in Apex and wanted to see if A) This is even possible and B) if someone could point me in the right direction.
just pu this in the end of that script code.
location.href = '/'+"{!Account.Id}";
All Answers
Yes it is possible,
Create a Detail Page Button
Execute as java script
Use this sort of syantax
Similarly you can access your field that you want to verify they are populated or not.
Let me know if it works for you to validate , then we can procedd to set Accounting Type to Vendor
Thanks, that works for validating. What about setting accounting type to vendor now?
Gr8 now we can move to update
Use this code
Change .Name with your field API Name , I took Name for example purpose.
I'm getting errors on this now. I just need it to select a checkbox
Can you give me your code as well as your field API name of check box
thanks, i pmed you the information
So it is working now, but I have to refresh the page after I hit the button to see that it checked the field. Can we add something that will refresh it after I press the button?
I just used this
It orked for me, can you try it once more, one thing this code will not refresh yur screen automatically so if you don't see result please refresh your page by hitting the url. If you want to refresh the page automatically I can provide you the code
Yes thank you so much for this. Is it easy to get it to refresh automatically?
just pu this in the end of that script code.
location.href = '/'+"{!Account.Id}";
Thanks a lot Shashikant. You really helped me out today.
Your welcome SquirrelMaster