• User Seth
  • 50 Points
  • Member since 2022

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 49
  • 10
I have one LWC can be used to upload a Image and display the image
    <input type="file"  name="image" id="file"  onchange={loadFile} style="display: none;">
    <label for="file" style="cursor: pointer;">Upload</label>
    <img id="output" width="200" />
loadFile(event) {
    var image = this.template.querySelector('img');
    image.src = URL.createObjectURL(event.target.files[0]);
This is giving temporary url of the image uploaded.
This url I am getting in the console is not working when I put that in Image Src tag in a separate LWC component.

How to get the original image url uploaded.
So that I can store this url in Custom field and show the image based on that url in that field. when any new image uploaded I will change url in the custom field and show new image based on that irl in that Custom Field(URL).
I have on LWC component in it I am displaying the LoggedIn User details like Name and FullPhotoUrl fields
To diaplay FullPhotoUrl user field I have used Image tag in the LWC
It is working fine When I am opening in the New Tab 
But When try to open that site in the Ignition window it's not displaying image and  I am gettin this error in the console.
"""Refused to load the image
 because it violates the following Content Security Policy directive: "img-src 'self' data: blob:"""
Is there any way to resolve this
I want to create a lwc component similar to the standard one that is in USER DETAIL 

User-added image
So this will display picture of LoggedIn User also they can update/Change  the Photo Exactly similar to standard one.

Is it possible with LWC component
I have one LWC component in it I have Layout which consists of three layout items
1.layout item=checkbox
2.layout item =Text
3.layout item =button
Now I want to select this checkbox when I click anywhere in that layout.
User-added image

My Footer is coming to the middle of the Page.I want my footer to stick to the bottom page even the Page is Empty.
Can anyone suggest me how this can be done in LWR sites

I have data in the External Database and with the help of Salesforce connect I am able to connect with this External DataBase and I am able to see the data.
Before Making Connection I have some question 
Question 1)Once  Salesforce Org  connect with external system, are we duplicating the same data that exists in External Database and storing the salesforce Or just we are getting the  copy of the External data into the salesforce ?
Question 2)Suppose if any data/record updates in External Database(from there end)
 Will the new data replicate in salesforce or It will show  the Old data?
Similarly In salesforce org if I update any data that belong to external database, Will that new data replicate in External Database immediately.
Can anyone please clarify these questions...
Is it possible to send SMS  Message to the Entered Phone Number in Apex..
I have One LWR site and It is Publicy Available
Also I have One LWC compoent that send Otp and Verify the OTP both are working fine

My Requirement 
On Sucessuful verification of  OTP then only I want to provide access to these Public Users to this LWR site 

How to put this LWC component In LWR before giving access to the Acess to the Public Users.
I have one LWR site in the Experience Cloud Site and it is publicy available to all.

[Since It is a Public Site I want to provide Just verification to Public/Normal Users through Email/Phone Verification].

Before Accessing the site I want the Public Users to Enter their Email/Mobile and It should send Verification Code to Email/Mobile they enter, Once Verified then they Can access this site.

How Can I achieve this requirement..
I have one LWR site and Select Login Discovery Page as Login Type for my site.
User-added imageAnd I am getting this Error
User-added image Given Apex Class:
// This auto-generated class contains the default logic for login discovery by SMS or email. 
// You can customize the code to ensure it meets your needs. The requestAttributes parameter 
// provides additional information you can use in the discovery logic. Attributes include CommunityUrl, 
// IpAddress, UserAgent, and location information (such as Country and City). 

global class AutocreatedDiscLoginHandler1669749918690 implements Auth.LoginDiscoveryHandler {

global PageReference login(String identifier, String startUrl, Map<String, String> requestAttributes) {
  if (identifier != null && isValidEmail(identifier)) {
    // Search for user by email 
    List<User> users = [SELECT Id FROM User WHERE Email = :identifier AND IsActive = TRUE];
    if (!users.isEmpty() && users.size() == 1) {
      // User must have verified email before using this verification method. We cannot send messages to unverified emails. 
      // You can check if the user has email verified bit on and add the password verification method as fallback.
      List<TwoFactorMethodsInfo> verifiedInfo = [SELECT HasUserVerifiedEmailAddress FROM TwoFactorMethodsInfo WHERE UserId = :users[0].Id];
      if (!verifiedInfo.isEmpty() && verifiedInfo[0].HasUserVerifiedEmailAddress == true) {
        // Use email verification method if the user's email is verified.
        return discoveryResult(users[0], Auth.VerificationMethod.EMAIL, startUrl, requestAttributes);
      } else {
        // Use password verification method as fallback if the user's email is unverified.
        return discoveryResult(users[0], Auth.VerificationMethod.PASSWORD, startUrl, requestAttributes);
    } else {
      throw new Auth.LoginDiscoveryException('No unique user found. User count=' + users.size());
  if (identifier != null) {
    String formattedSms = getFormattedSms(identifier);
    if (formattedSms != null) {
      // Search for user by SMS 
      List<User> users = [SELECT Id FROM User WHERE MobilePhone = :formattedSms AND IsActive = TRUE];
      if (!users.isEmpty() && users.size() == 1) {
        // User must have verified SMS before using this verification method. We cannot send messages to unverified mobile numbers. 
        // You can check if the user has mobile verified bit on or add the password verification method as fallback.
        List<TwoFactorMethodsInfo> verifiedInfo = [SELECT HasUserVerifiedMobileNumber FROM TwoFactorMethodsInfo WHERE UserId = :users[0].Id];
        if (!verifiedInfo.isEmpty() && verifiedInfo[0].HasUserVerifiedMobileNumber == true) {
          // Use SMS verification method if the user's mobile number is verified.
          return discoveryResult(users[0], Auth.VerificationMethod.SMS, startUrl, requestAttributes);
        } else {
          // Use password verification method as fallback if the user's mobile number is unverified.
          return discoveryResult(users[0], Auth.VerificationMethod.PASSWORD, startUrl, requestAttributes);
      } else {
        throw new Auth.LoginDiscoveryException('No unique user found. User count=' + users.size());
  if (identifier != null) {
    // You can customize the code to find user via other attributes, such as SSN or Federation ID
  throw new Auth.LoginDiscoveryException('Invalid Identifier');

private boolean isValidEmail(String identifier) {
  String emailRegex = '^[a-zA-Z0-9._|\\\\%#~`=?&/$^*!}{+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,4}$';
  // source: http://www.regular-expressions.info/email.html 
  Pattern EmailPattern = Pattern.compile(emailRegex);
  Matcher EmailMatcher = EmailPattern.matcher(identifier);
  if (EmailMatcher.matches()) { return true; }
  else { return false; }

private String getFormattedSms(String identifier) {
  // Accept SMS input formats with 1 or 2 digits country code, 3 digits area code and 7 digits number
  // You can customize the SMS regex to allow different formats
  String smsRegex = '^(\\+?\\d{1,2}?[\\s-])?(\\(?\\d{3}\\)?[\\s-]?\\d{3}[\\s-]?\\d{4})$';
  Pattern smsPattern = Pattern.compile(smsRegex);
  Matcher smsMatcher = SmsPattern.matcher(identifier);
  if (smsMatcher.matches()) {
    try {
      // Format user input into the verified SMS format '+xx xxxxxxxxxx' before DB lookup
      // Append US country code +1 by default if no country code is provided
      String countryCode = smsMatcher.group(1) == null ? '+1' : smsMatcher.group(1);
      return System.UserManagement.formatPhoneNumber(countryCode, smsMatcher.group(2));
    } catch(System.InvalidParameterValueException e) {
      return null;
  } else { return null; }

private PageReference getSsoRedirect(User user, String startUrl, Map<String, String> requestAttributes) {
  // You can look up if the user should log in with SAML or an Auth Provider and return the URL to initialize SSO.
  return null;

private PageReference discoveryResult(User user, Auth.VerificationMethod method, String startUrl, Map<String, String> requestAttributes) {
  //Only external users with an External Identity or community license can login using Site.passwordlessLogin
  //Use getSsoRedirect to enable internal user login for a community
  PageReference ssoRedirect = getSsoRedirect(user, startUrl, requestAttributes);
  if (ssoRedirect != null) {
    return ssoRedirect;
  } else {
    if (method != null) {
      List<Auth.VerificationMethod> methods = new List<Auth.VerificationMethod>();
      PageReference pwdlessRedirect = Site.passwordlessLogin(user.Id, methods, startUrl);
      if (pwdlessRedirect != null) {
        return pwdlessRedirect;
      } else {
        throw new Auth.LoginDiscoveryException('No Passwordless Login redirect URL returned for verification method: ' + method);
    } else {
      throw new Auth.LoginDiscoveryException('No method found');

How Can I modify this Apex Class to AnyPerson(Both Internal and External) Can Enter any Email and we need verify mail  is correct or not by  just send Verification code  Once verified They can access this LWR site.
I have a LWR site through it anyone access it anywhere and  create leads through it and its Publicy Available to all.(Its working FIne for All User)
Now to provide some security this to Site I wnat to add Mobile / Email  verifiation to this site.
So when any person enters his Mobile/Email it should send OTP  then verify the OTP After successful verification Provide access to this SIte to that User.

How to achieve this Mobile/Email Verification to this Site.
Can anyone suggest with best solution for this
I have one LWR site  in it I am unable to login even providing the Correct credentails
Can anyone suggest me how to provide login in the LWR site

I have created one LWR site in it I have added Lead Form Component I but I am uable to create lead from it.
User-added image

And I want both Authencated and unauthencated user Can directly create lead from it.
<div style="background-color:red;”>
    <div style="color: #FFFFFF; padding:80px;">LeftRight a 3000 CoolSubcriptions      |    
        <a style="color:white;" href="https://www.Facebook.com/" target="_blank">King of Ant </a> / 
        <a style="color:white;" href="https://www.Googlet.com/"  target="_blank">History Policy</a>
(Since  "" "" not coming  Added Screenshot of the Exact Code)

User-added image
User-added imageThis is working perfectly as expected in both Desktop and Tablet but when comes to Mobile words are not in line.
I am new this I got my desired result butI  I think I didn't follow the Best Practise in it. Can anyone help to write this in a good format.So that it  will work properly for All devices formats as expected.
One component is publishing the id of the contact and Other component needs to Update Account Id in the the Contact to Null based on the Id Published through Lightning Message Service.
Html File:::
  <lightning-card title="Record view from for Account">
JS File::::
import { LightningElement, wire } from "lwc";
import UpdateContact from "@salesforce/apex/AccountContactController.updateContact";
import {
} from "lightning/messageService";
import SimpleChannel from "@salesforce/messageChannel/SimpleChannel__c";
export default class DisplayContact extends LightningElement {
  subscription = null;
  @wire(MessageContext) messageContext;
  @wire(UpdateContact, { contactId: "$strCapturedText" }) contacts;
  subscribeToMessageChannel() {
    if (!this.subscription) {
      this.subscription = subscribe(
        (message) => this.setCaptureText(message)
  unsubscribeToMessageChannel() {
    this.subscription = null;
  connectedCallback() {
  // This method will run once the component is removed from DOM.
  disconnectedCallback() {
  // This method will update the value once event is captured.
  setCaptureText(message) {
    this.strCapturedText = message.data;
Apex Method:
    public static Id updateContact(string contactId){
        Contact c = [select Id,AccountId from Contact where Id =: contactId];
        c.AccountId =Null;
        update c;
        return c.Id;
 I am getting the data from the publish component and able to show the data What I receive  but when I want to Update with the help of Apex Method it is not working and not showing any data
Can anyone suggest me how to resolve this
I have data in the AWS and I want to get that data into Salesforce and I want to Show this Data in the Experience Cloud Site....
Can anyone suggest me best way to this..... 
I have one Experience Cloud Site in it I added one HTMLEditor  in Template footer
But I don't know why footer  is coming in the Middle of the page only for the NewPage I created in it for Remaining Pages it is at the bottom
(For the New Page I have added a Navigation Item to take into that New Page)

I have added My Html Eidtor Component in the Content  of the new PageUser-added image

My Final Outcome looks like this

User-added imageI want the footer needs to be at the bottom of the page no matter what the size of the browser
I have on LWC component in it I am displaying the LoggedIn User details like Name and FullPhotoUrl fields
To diaplay FullPhotoUrl user field I have used Image tag in the LWC
It is working fine When I am opening in the New Tab 
But When try to open that site in the Ignition window it's not displaying image and  I am gettin this error in the console.
"""Refused to load the image
 because it violates the following Content Security Policy directive: "img-src 'self' data: blob:"""
Is there any way to resolve this
This What I want in the Experience Cloud site
User-added image

With the help of HTML Editor Component I made like this but how add that real logo and how to remove that middile lineUser-added image
My Requirement I want to create a Custom button so  When I click That button it will redirect me to the External Link
User-added imageHere I add Car Logo how to increase its size
What is the best to increase the Size of Car in this Experience Cloud
User-added image
How to apply theme and brand in Experience Cloud Site.
My Requirement :
I have one website outside of the salesforce.
Now I am Building a brand new site in Experience Cloud
So my  new digital experience must be consistent with the current (website outside of the salesforce) both theme and brand
Where I can apply same theme and brand in Experience Cloud Site.
Please respond I am new to Experience Cloud.
Thank you in advance.