We are checking the couple of conditions based on javascript logic.
Contact email checking: if the contact email is already associated with some other user we needs to be popup message like:
"User is already exists with the same email".
Partner Licence checking: if there is no licences then we need to popup message like "You have not enough license available,please create support case".
I have tried below Javascript logic, the above points are not working.
Button Logic:
var results = sforce.apex.execute("validatePartnar", "validatePartnerId",{contactId:"{!Contact.Id}"},{contactEmail:"{!Contact.Email}"},{});
Web service class:
lobal class validatePartnar{ webService static string validatePartnerId(String contactId,String contactEmail){ string message =''; List conListForPartnar = [SELECT Id,AccountId,Account.IsPartner,Partner_User__c,Partner_Type__c from Contact where id =: contactId LIMIT 1]; List conListForEmail = [SELECT Id,name, email from user where email =:contactEmail];
if(conListForEmail.size() > 0){
message = 'User is already exists with the same email';
return message;
}
else{
return message;
}
}
}
Thanks