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
Sfdc SivaSfdc Siva 

Contact check box field update help

Hi Team,

In contact object we have one checkbox field "partneruser" This checbox is when partner user is created automaticlly the chckbox got checked on contact which is working fine.Problem is when we are tying to deactiveate the partner user needs to be unchecked partneruser checbox on contact page.
Please help us to creating a  logic or processbuilder or workflow.

Thanks
 
Ahmad J. KoubeissyAhmad J. Koubeissy
Hello, how do you deactivate the partner user (contact)?
Sfdc SivaSfdc Siva
Hi Ahmad,

On Contact page we have one button  called "Externaluser" under externaluser we have "disable partner user".When we are trying to disablepartner user immediately on partneruserecord Activate field get unchecked.
when get unchecked Active button partneruser checkbox also get unchecked on contact page.Please help me on this.

Thanks
 
Ahmad J. KoubeissyAhmad J. Koubeissy
You can either create a process builder or a trigger on partnerUser Object.

for the trigger code, considering that partnerUser is a child of contact and contact__c is the lookup field on the partnerUser.
 
trigger partnerUserAfterUpdate on partnerUserObject (after update) {

    set<id> contactsID = new set<id>();
	for(partnerUserObject partnerUser :  Trigger.new) {
		if(trigger.oldmap.get(partnerUser.id).activate_checkbox__c!= partnerUser.activate_checkbox__c)
			contactsID.add(partnerUser.contact__c);
	}
	
	list<contact> contacts = [select id,partner_User__c from contact where id in :contactsID];
	for(contact con:contacts){
		if(con.partner_User__c==true){
			con.partner_User__c=false;
		}else{
			con.partner_User__c=true;
		}
	}
	
    update contacts;                                               
    
}

replace the fields with your own fields api name