• Michelle Chaplin Regal
  • NEWBIE
  • 30 Points
  • Member since 2014
  • Application Analyst
  • T.D. Williamson


  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 4
    Replies
Hi All,

I have one salesforce site where I have added some visual force pages.
From those pages I am not able edit input field values in one visual force page.

In that page I have one "get set" variable for Contact object and for contact object all permissions are given to site user.

The same page works fine when it runs normally like "salesforceinstanceurl/apex/vfpagename"

Can anyone help me to resolve it issue?
 
I have a lightning web component (based on the one in this trailhead module) that shows up as expected when I add it to the org homepage, but doesn't show any data when I add it to a community page. I've verified that the community user has read access to the Order object and the referenced fields. 

I've updated the metadata file to make it available for Experience Cloud:
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>51.0</apiVersion>
    <isExposed>true</isExposed>
<targets>
	<target>lightning__AppPage</target>
	<target>lightning__RecordPage</target>
	<target>lightning__HomePage</target>
    <target>lightningCommunity__Page</target>
    <target>lightningCommunity__Default</target>
</targets>

</LightningComponentBundle>
Here's the HTML:
<template>
	<lightning-card title="Orders">
		<div class="slds-card__body_inner">
			<!-- Start order list -->
			<template if:true={orders.data}>
				<lightning-layout multiple-rows="true" pull-to-boundary="small">
					<template for:each={orders.data} for:item="o">
						<lightning-layout-item key={o.Id} size="3" class="slds-var-p-around_x-small">
							<!-- Start order tile -->
							<lightning-card title={o.Order_Id__c} >
								<div class="slds-var-p-horizontal_small">
									<div class="slds-media">
										
										<div class="slds-media__body">
											<p class="slds-var-m-bottom_xx-small">PO: {o.PoNumber}</p>
											<p class="slds-var-m-bottom_xx-small">Status: {o.Order_Status__c}</p>
                                            <p class="slds-var-m-bottom_xx-small">Tracking Number: {o.Tracking_Number__c}</p>
										</div>
									</div>
								</div>
							</lightning-card>
							<!-- End order tile -->
						</lightning-layout-item>
					</template>
				</lightning-layout>
			</template>
			<!-- End order list -->
			<!-- Data failed to load -->
			<template if:true={orders.error}>
				<div class="slds-text-color_error">
					An error occurred while loading the list: {error.message} 
				</div>
			</template>
		</div>
	</lightning-card>
</template>
Here's the js:
import { LightningElement,wire } from 'lwc';

/** CustomerOrdersController.getOrders Apex method */
import getOrders from '@salesforce/apex/CustomerOrdersController.getOrders';
export default class OrderList extends LightningElement {
	@wire(getOrders) orders;
	
}
And here's the Apex controller:
public with sharing class CustomerOrdersController {
    @AuraEnabled(Cacheable=true)
    public static order[] getOrders() {
            return [
                SELECT 
                    Id, 
                    Name,
                    Order_Id__c,
                    PoNumber,
                    Order_Status__c,
                    Service_Order_Start_Date_Time__c,
                    Product_Confirm_Date__c,
                    Effective_Total_All_Orders__c,
                    Tracking_Number__c 
                FROM Order
                WHERE Type != 'Change Order' 
                    AND PO_Override_by_Sales_Manager__c = False 
                    AND PoNumber != null
                LIMIT 20
            ];
    }
}

 
I'm in the Inspect Objects at Checkpoints step of the Developer Console Basics module, and I open the EmailMissionSpecialist class and set the Debug Log Level for ApexCode to Finest, but the line inspectResults(results); does not get marked as a checkpoint in the console (no red dot). When I run the execute anonymous command, no checkpoints are shown under the checkpoints tab.
I have a dynamic SOQL query that keeps causing an error with my test class. I'm sure it's formatted incorrectly, but I can't figure it out from the documentation. Can anyone help?
    public static date today = date.today();
    public static date tomorrow = today.addDays(1);
    public static date oneWeek = today.addDays(7);
    public static final Id eventRegistrationRecordTypeId = Schema.SObjectType.Opportunity.getRecordTypeInfosByName().get('Event Registration') == null ? null : Schema.SObjectType.Opportunity.getRecordTypeInfosByName().get('Event Registration').getRecordTypeId();
    public static final Id vipEventRecordTypeId = Schema.SObjectType.Campaign.getRecordTypeInfosByName().get('VIP Event') == null ? null : Schema.SObjectType.Campaign.getRecordTypeInfosByName().get('VIP Event').getRecordTypeId();
    private static string query = 'SELECT Id FROM Opportunity WHERE RecordTypeId = :eventRegistrationRecordTypeId AND Campaign.RecordTypeId = :vipEventRecordTypeId AND (StageName = "Closed Won" OR StageName = "Pledged") AND (Campaign.EndDate = :tomorrow OR Campaign.EndDate = :oneWeek)';

The error message I'm getting is System.QueryException: line 1:146 no viable alternative at character '"'
I'm trying to set up Facebook social sign-in for a customer communityy and keep getting the error message:
We can’t log you in because of the following error.
NO_ACCESS: Unable to find a user

Here's the SSO handler code:
 
global class SocialRegHandler implements Auth.RegistrationHandler{
    
    private static final String ORG_SUFFIX = '.sso.badge.org';
    public static final String DEFAULT_ACCOUNTNAME = 'MADD';
    
/**
 * Let anyone register as long as the required fields are supplied
 * 
 * We require email, lastName, firstName
 * 
 * @data - the user's info from the Auth Provider
 **/ 
global boolean canCreateUser(Auth.UserData data) {
    System.debug('canCreateUser was called for ' + (data != null ? data.email : 'null'));
    Boolean retVal = (data != null 
            && data.email != null
            && data.lastName != null
            && data.firstName != null);
    
    System.debug('data.username='+data.username);
    System.debug('data.email='+data.email);
    System.debug('data.lastName='+data.lastName);
    System.debug('data.firstName='+data.firstName);
    
    return retVal;
}

/**
 * Create the User - A required method to implement the Handler Interface
 * 
 * @param portalId  - Id of the Community
 * @param data - Auth Provider user data describing the User to create
 * 
 * @return User that has been initialized
**/ 
global User createUser(Id portalId, Auth.UserData data){
    if(!canCreateUser(data)) {
            if(data.email != null){
            User u = [Select Id , username from User where email =: data.email];
            return u;
        } else {
            return null;
        }
        
    }
    
    // Is this a Community Context?
    if(data.attributeMap.containsKey('sfdc_networkid')) {
        System.debug('Registering Community user: ' + data.email);
        
        // To keep things modular, we're creating the PersonAccount in a separate method
        // Id contactId = createPersonAccountContact(data);
        Contact c = new Contact();
        c.LastName = data.lastName;
        c.FirstName = data.FirstName;
        c.Email = data.email;
        insert c;
        
        // You'd likely use other logic to assign the Profile
        Profile p = [SELECT Id FROM profile WHERE name='MADD Customer Community User'];

        // Keeping it modular, we initialize the user in another method
        User u = createUser(data,p);
        
        u.contactId = c.id;
        return u;
    } else {
        //This is not a community, so we Assign an internal profile
        Profile p = [SELECT Id FROM profile WHERE name='Standard User'];
        
        // Keeping it modular, we initialize the user in another method
        User u = createUser(data,p);

        return u;
    }
}

/**
 * Update the user
 * @param portalId  - Id of the Community
 * @param data - Auth Provider user data describing the User to create
 **/     
global void updateUser(Id userId, Id portalId, Auth.UserData data){
    System.debug('Update User called for: ' + data.email);
    
    User u = new User(id=userId);
    u.email = data.email;
    u.lastName = data.lastName;
    u.firstName = data.firstName;
    update(u);
}
    /**
     * Create a PersonAccount for the contact
     * 
     * @param data - Facebook provided context for this User
     
    private Id createPersonAccountContact(Auth.UserData data) {
        Account person = new Account();
        person.LastName = data.lastName;
        person.FirstName = data.FirstName;
        person.personEmail = data.email;
        person.RecordTypeId = [Select Id From RecordType 
                                Where SobjectType='Account' 
                                  AND isPersonType=true LIMIT 1].id;
        
        insert person;
        
        System.debug('Person Account created for ' + data.email + ' id=' + person.id);
        
        /**
         * This next step is necessary to get a valid contact Id,
         * it won't exist until the PersonAcct is saved
                 
        Account a = [Select PersonContactId From Account Where Id = :person.Id];
        
        return a.PersonContactId; 

    }
    **/
    /**
     * Create and initialize the User but don't save it yet
     * 
     * @param data - the provided User context from FaceBook
     * @param p - the Profile we are going to assign to this user
     * 
     * @return User that has been initialized but not Saved
     **/ 
    private User createUser(Auth.UserData data, Profile p) {
        User u = new User();
        u.username = data.email + ORG_SUFFIX;
        u.email = data.email;
        u.lastName = data.lastName;
        u.firstName = data.firstName;
        String alias = data.firstName + data.lastName;
        
        //Alias must be 8 characters or less
        if(alias.length() > 8) {
            alias = alias.substring(0, 8);
        }
        u.alias = alias;
        u.languagelocalekey = UserInfo.getLocale();
        u.localesidkey = UserInfo.getLocale();
        u.emailEncodingKey = 'UTF-8';
        u.timeZoneSidKey = 'America/Los_Angeles';
        u.profileId = p.Id;
        return u;
    }
    
    
}

Customer community users cannot self register, so I'm getting the error message when signing in as an active customer community user with the same email address attached to the Facebook ID as the Contact and Customer Community user.

Are their any settings, etc. I'm missing?
 
I'm trying to create a decision node on my flow to determine if a contact ID is in a list of contact ID's I have. I'm using the following logic:

Variable Collection  CONTAINS SObjectName.Id

I have also tried using a Variable instead of a Variable collection that is just a comma-separated text field with all the Contact IDs, but neither one seems t be working.

Is there a way to do this?
I have a visualforce page extension that's throwing up an error:

Visualforce Error
Exception: Illegal assignment from void to Pick_Run__c
Error occurred loading controller 'newpickrun' for page createpickrun
 
public with sharing class newpickrun {

    public Integer OpenShipmentsCount { get; set; }
    public Integer PriorityShipmentsCount { get; set; }
    public Integer PrevBackorderedCount { get; set; }
    public string DebugLog { get; set; }
    private ApexPages.StandardController ctrl;
    public Pick_Run__c pickrun;

    public newpickrun(ApexPages.StandardController controller) {
        // setup controller
        ctrl = controller;
        pickrun = (Pick_Run__c)ctrl.getRecord();
        GetOpenShipmentInfo();
        GetOtherInfo();
    }

    public void customSave() {
        System.debug('before upsert');
        
        upsert pickrun;
        
        System.debug('after upsert');

        // debug to see the object
        DebugLog = JSON.serialize(pickrun);

        // now that the pickrun has been created, populate all the quotes that
        // meet the criteria on the record
        //PickRunExt.AddQuotesToPickrun(pickrun);
        PickRunExt.GetPickrunDetails2(pickrun);
        
        // redirect with the id to refresh (will probably be a seperate page later)
        //PageReference redirect = Page.picklist;  // Commented on 28-APR-2016: Point #3
       /* PageReference redirect = Page.picklist_WIP;
        redirect.getParameters().put('id', pickrun.Id);
        system.debug('---@@@pickrun'+ pickrun);
        return redirect;*/
        
       //update picked = true
       List<Pick_Run_Detail__c> pickRunDetailsList = new List<Pick_Run_Detail__c>();
       try {
            if(pickRun.Status__c != 'Done') {
                pickRunDetailsList = [select id, Picked__c,Recommended_Whse__c,Recommended_FPick__c from Pick_Run_Detail__c where Pick_Run__c =: pickrun.id ];
                system.debug('----###pickRunDetailsList ---------'+pickRunDetailsList.size() );
                for( Pick_Run_Detail__c pikRun :pickRunDetailsList ){
                 pikRun.Picked__c  = true;
                 pikRun.From_FPick__c = pikRun.Recommended_FPick__c; 
                 pikRun.From_Warehouse__c = pikRun.Recommended_Whse__c;
                }
                update pickRunDetailsList;
           }
        }
        catch(Exception e) {
            System.debug('------inside catch');
            throw e;
        }

        // redirect to the view page for right now until the other page is ready
        //return null; //ctrl.view();
    }
    
      public PageReference goToPickRunDetail() {
        System.debug('before closing...');
        //called for close PickRun
        pickRun = PickrunExt.ClosePickrun(pickRun.Id);
        System.debug('after closing...');  
        //pagereference pr = new pagereference('/' + pickRun.id); // Commented as Point # 2 10-MAY-2016
        
        PageReference redirect = Page.picklist;
        redirect.getParameters().put('id', pickrun.Id);
        return redirect;
    }
        

    public void GetOpenShipmentInfo() {

        List<Quote> quotes = [
            SELECT  Close_Date__c 
            FROM    Quote 
            WHERE   Status = 'Open'
            ORDER BY Close_Date__c ASC
            LIMIT 10000
        ];

        OpenShipmentsCount = quotes.size();
        pickrun.Maximum_Number_of_Orders__c = OpenShipmentsCount;
        pickrun.Earliest_Order_Date__c = quotes.size() == 0 ? null : quotes[0].Close_Date__c;
        pickrun.Latest_Order_Date__c = System.today();
    }

    private void GetOtherInfo() {
        PriorityShipmentsCount = [SELECT COUNT() FROM Quote WHERE Priority_Shipment__c = true AND Status = 'Open'];
        PrevBackorderedCount = [SELECT COUNT() FROM Quote WHERE Previously_on_Backorder__c = true AND Status = 'Open'];
        pickrun.Number_of_Priority_Shipments__c = PriorityShipmentsCount;
        pickrun.Number_of_Previously_Backordered__c = PrevBackorderedCount;
    }
}

To top it all off, this code works fine in my partial copy sandbox, so I don't know what's causing it to throw an error in production.
 
I have a lightning web component (based on the one in this trailhead module) that shows up as expected when I add it to the org homepage, but doesn't show any data when I add it to a community page. I've verified that the community user has read access to the Order object and the referenced fields. 

I've updated the metadata file to make it available for Experience Cloud:
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>51.0</apiVersion>
    <isExposed>true</isExposed>
<targets>
	<target>lightning__AppPage</target>
	<target>lightning__RecordPage</target>
	<target>lightning__HomePage</target>
    <target>lightningCommunity__Page</target>
    <target>lightningCommunity__Default</target>
</targets>

</LightningComponentBundle>
Here's the HTML:
<template>
	<lightning-card title="Orders">
		<div class="slds-card__body_inner">
			<!-- Start order list -->
			<template if:true={orders.data}>
				<lightning-layout multiple-rows="true" pull-to-boundary="small">
					<template for:each={orders.data} for:item="o">
						<lightning-layout-item key={o.Id} size="3" class="slds-var-p-around_x-small">
							<!-- Start order tile -->
							<lightning-card title={o.Order_Id__c} >
								<div class="slds-var-p-horizontal_small">
									<div class="slds-media">
										
										<div class="slds-media__body">
											<p class="slds-var-m-bottom_xx-small">PO: {o.PoNumber}</p>
											<p class="slds-var-m-bottom_xx-small">Status: {o.Order_Status__c}</p>
                                            <p class="slds-var-m-bottom_xx-small">Tracking Number: {o.Tracking_Number__c}</p>
										</div>
									</div>
								</div>
							</lightning-card>
							<!-- End order tile -->
						</lightning-layout-item>
					</template>
				</lightning-layout>
			</template>
			<!-- End order list -->
			<!-- Data failed to load -->
			<template if:true={orders.error}>
				<div class="slds-text-color_error">
					An error occurred while loading the list: {error.message} 
				</div>
			</template>
		</div>
	</lightning-card>
</template>
Here's the js:
import { LightningElement,wire } from 'lwc';

/** CustomerOrdersController.getOrders Apex method */
import getOrders from '@salesforce/apex/CustomerOrdersController.getOrders';
export default class OrderList extends LightningElement {
	@wire(getOrders) orders;
	
}
And here's the Apex controller:
public with sharing class CustomerOrdersController {
    @AuraEnabled(Cacheable=true)
    public static order[] getOrders() {
            return [
                SELECT 
                    Id, 
                    Name,
                    Order_Id__c,
                    PoNumber,
                    Order_Status__c,
                    Service_Order_Start_Date_Time__c,
                    Product_Confirm_Date__c,
                    Effective_Total_All_Orders__c,
                    Tracking_Number__c 
                FROM Order
                WHERE Type != 'Change Order' 
                    AND PO_Override_by_Sales_Manager__c = False 
                    AND PoNumber != null
                LIMIT 20
            ];
    }
}

 
Hi All,

I have one salesforce site where I have added some visual force pages.
From those pages I am not able edit input field values in one visual force page.

In that page I have one "get set" variable for Contact object and for contact object all permissions are given to site user.

The same page works fine when it runs normally like "salesforceinstanceurl/apex/vfpagename"

Can anyone help me to resolve it issue?
 
I'm trying to set up Facebook social sign-in for a customer communityy and keep getting the error message:
We can’t log you in because of the following error.
NO_ACCESS: Unable to find a user

Here's the SSO handler code:
 
global class SocialRegHandler implements Auth.RegistrationHandler{
    
    private static final String ORG_SUFFIX = '.sso.badge.org';
    public static final String DEFAULT_ACCOUNTNAME = 'MADD';
    
/**
 * Let anyone register as long as the required fields are supplied
 * 
 * We require email, lastName, firstName
 * 
 * @data - the user's info from the Auth Provider
 **/ 
global boolean canCreateUser(Auth.UserData data) {
    System.debug('canCreateUser was called for ' + (data != null ? data.email : 'null'));
    Boolean retVal = (data != null 
            && data.email != null
            && data.lastName != null
            && data.firstName != null);
    
    System.debug('data.username='+data.username);
    System.debug('data.email='+data.email);
    System.debug('data.lastName='+data.lastName);
    System.debug('data.firstName='+data.firstName);
    
    return retVal;
}

/**
 * Create the User - A required method to implement the Handler Interface
 * 
 * @param portalId  - Id of the Community
 * @param data - Auth Provider user data describing the User to create
 * 
 * @return User that has been initialized
**/ 
global User createUser(Id portalId, Auth.UserData data){
    if(!canCreateUser(data)) {
            if(data.email != null){
            User u = [Select Id , username from User where email =: data.email];
            return u;
        } else {
            return null;
        }
        
    }
    
    // Is this a Community Context?
    if(data.attributeMap.containsKey('sfdc_networkid')) {
        System.debug('Registering Community user: ' + data.email);
        
        // To keep things modular, we're creating the PersonAccount in a separate method
        // Id contactId = createPersonAccountContact(data);
        Contact c = new Contact();
        c.LastName = data.lastName;
        c.FirstName = data.FirstName;
        c.Email = data.email;
        insert c;
        
        // You'd likely use other logic to assign the Profile
        Profile p = [SELECT Id FROM profile WHERE name='MADD Customer Community User'];

        // Keeping it modular, we initialize the user in another method
        User u = createUser(data,p);
        
        u.contactId = c.id;
        return u;
    } else {
        //This is not a community, so we Assign an internal profile
        Profile p = [SELECT Id FROM profile WHERE name='Standard User'];
        
        // Keeping it modular, we initialize the user in another method
        User u = createUser(data,p);

        return u;
    }
}

/**
 * Update the user
 * @param portalId  - Id of the Community
 * @param data - Auth Provider user data describing the User to create
 **/     
global void updateUser(Id userId, Id portalId, Auth.UserData data){
    System.debug('Update User called for: ' + data.email);
    
    User u = new User(id=userId);
    u.email = data.email;
    u.lastName = data.lastName;
    u.firstName = data.firstName;
    update(u);
}
    /**
     * Create a PersonAccount for the contact
     * 
     * @param data - Facebook provided context for this User
     
    private Id createPersonAccountContact(Auth.UserData data) {
        Account person = new Account();
        person.LastName = data.lastName;
        person.FirstName = data.FirstName;
        person.personEmail = data.email;
        person.RecordTypeId = [Select Id From RecordType 
                                Where SobjectType='Account' 
                                  AND isPersonType=true LIMIT 1].id;
        
        insert person;
        
        System.debug('Person Account created for ' + data.email + ' id=' + person.id);
        
        /**
         * This next step is necessary to get a valid contact Id,
         * it won't exist until the PersonAcct is saved
                 
        Account a = [Select PersonContactId From Account Where Id = :person.Id];
        
        return a.PersonContactId; 

    }
    **/
    /**
     * Create and initialize the User but don't save it yet
     * 
     * @param data - the provided User context from FaceBook
     * @param p - the Profile we are going to assign to this user
     * 
     * @return User that has been initialized but not Saved
     **/ 
    private User createUser(Auth.UserData data, Profile p) {
        User u = new User();
        u.username = data.email + ORG_SUFFIX;
        u.email = data.email;
        u.lastName = data.lastName;
        u.firstName = data.firstName;
        String alias = data.firstName + data.lastName;
        
        //Alias must be 8 characters or less
        if(alias.length() > 8) {
            alias = alias.substring(0, 8);
        }
        u.alias = alias;
        u.languagelocalekey = UserInfo.getLocale();
        u.localesidkey = UserInfo.getLocale();
        u.emailEncodingKey = 'UTF-8';
        u.timeZoneSidKey = 'America/Los_Angeles';
        u.profileId = p.Id;
        return u;
    }
    
    
}

Customer community users cannot self register, so I'm getting the error message when signing in as an active customer community user with the same email address attached to the Facebook ID as the Contact and Customer Community user.

Are their any settings, etc. I'm missing?