You need to sign in to do that
Don't have an account?
sfdcsushil
Can we check if user has access to a particular record type in javascript
I am creating a custom clone button. If user is trying to clone a record which has record type for which he does not have access, i want dont want to pass record type id to url.
Please let me know how can we check in javascript if user has access to particular record type.
{!REQUIRESCRIPT("/soap/ajax/27.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/27.0/apex.js")}
var result = sforce.connection.describeSObject("Contact");
for (var i=0; i<result.recordTypeInfos.length; i++) {
var rt = result.recordTypeInfos[i];
alert("Record Type Name: "+rt.name);
alert("Record Type Id: "+rt.recordTypeId);
alert("Record Type Availability: "+rt.available);
}
All Answers
{!REQUIRESCRIPT("/soap/ajax/27.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/27.0/apex.js")}
var result = sforce.connection.describeSObject("Contact");
for (var i=0; i<result.recordTypeInfos.length; i++) {
var rt = result.recordTypeInfos[i];
alert("Record Type Name: "+rt.name);
alert("Record Type Id: "+rt.recordTypeId);
alert("Record Type Availability: "+rt.available);
}
Thanks for your prompt reply. That worked.