0

I have site and guest user is activated in there. In this case, for allowing records creation from guest user, I granted permission to site guest user profile.

However, now I saw some weird situation. Guest user can do action on site and related records are created well, but when Internal Salesforce user try to do the same action on site, records are not created with error.

This user has full permission(Admin profile)

How can it occur?

I share code that creates this records below.

trigger UpsertRecords on Vision__c (before insert, before update) {

if(Trigger.isbefore && (Trigger.isinsert || Trigger.isupdate)){
    Set <String> vsset = new Set <String>();
    for(Vision__c vs : Trigger.new) vsset .add(bk.Phone__c);
    List <Account> qracc = [SELECT id, phone__c FROM Account WHERE phone__c IN:vsset];
    for(integer i=0; i<Trigger.new.size(); i++){
        if(qracc.size()>0){
            for(Account ac : qracc){
                if(Trigger.new[i].phone__c == ac.Phone__c){
                    Trigger.new[i].Account__c = ac.id;
                }                  
                else if(Trigger.new[i].phone__c != ac.Phone__c && Trigger.new[i].Status__c=='Confirm'){
                        Account inac=new Account(); 
                        inac.LastName=Trigger.new[i].Name;
                        inac.PersonEmail=Trigger.new[i].Email__c;
                        inac.Phone__c=Trigger.new[i].Phone__c;
                        insert inac;
                        Trigger.new[i].Account__c = inac.id;
                   }
                }
        }else if(Trigger.new[i].Status__c=='Confirm'){
            Account inac=new Account(); 
            inac.LastName=Trigger.new[i].Name__c;
            inac.PersonEmail=Trigger.new[i].Email__c;
            inac.LeadSource__pc='External';
            inac.Phone__c=Trigger.new[i].Phone__c;
            insert inac;
            Trigger.new[i].Account__c = inac.id;
        }
    }
}

}

Thanks in advance for your attention.

@sfdcfox, When user enter some information at VF, First, Create Vision__c record at VF/Controller. Second, Before trigger work in above post, and update some(A) field before insert. Thrid, After record is created, Process(PB) is called and use A field in Process.

However, only internal SFDC User test from First step, Process show me error that A field value is null.

When site.com guest user try to do it, all thing works well.

  • What's the error? Please edit your question to include more information. – sfdcfox Dec 28 '18 at 1:53
  • @sfdcfox, I added detail at the bottom of the post. – YoungHoon Kim Dec 28 '18 at 3:54
  • 1
    Can you check FLS? That internal profile has access to that field? – Pranay Jaiswal Dec 28 '18 at 4:20
  • I checked FLS and there is no point.. For making sure, I checked all field as editable. I'll check the error occurs again before long. – YoungHoon Kim Dec 28 '18 at 9:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.