function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
JacobusJacobus 

Update profile user license type

Hi,
I am trying to find a way to update an existing profile with a new user license type, ex Force.com App Subscription -> Company Community using java script without having to clone. I am unfortunately battling with the code.
Any advise is welcome. See code below.
 
{!REQUIRESCRIPT("/soap/ajax/37.0/connection.js")} 

var all_select = document.getElementsByTagName("userLicense");
var myArray = new Array(500)
for (i = 0; i < all_select.length; i++) {
    
myArray.push(all_select[i].id +".value="+all_select[i].value);
}
for (var i = 0; i < myArray.length; i++) {
    alert("Profile : " + myArray[i]);
}

 
NagendraNagendra (Salesforce Developers) 
Hi Jacobus,

Please check with below javascript code snippet.
var all_select = document.getElementsByTagName("select");
var myArray = new Array(500)
for (i = 0; i < all_select.length; i++) {
    
myArray.push(all_select[i].id +".value="+all_select[i].value);
}
for (var i = 0; i < myArray.length; i++) {
    //console.log(myArray[i]);

console.log("document.editPage."+myArray[i]);
}
For more information on same idea chek here: Mark this as solved if it helps.

Best Regards,
Nagendra.P