• RangaRayapati
  • NEWBIE
  • 0 Points
  • Member since 2020

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

We are facing an issue generate a invoice pdf in community. Calling VF page(Invoice pdf) in lightning component button, in Internal Salesforce it is working fine but when calling same community it blank field values. Permission given in shared setting for Opportunity Object because Quote controlling by parent, create a controller without sharing, given in public site settings and also in profile we added the vf page and controller class.
Hi,

I need a regular expression for the below formats allowing in text box in validation rule.

$100
200$
25%
0.25

User can directly enter the amount in doller or decimal values lessthan 1 or percentage values lessthan 100 for the discount

Please provide an regular expression to allow above formats.

Thanks in advance!
I have written below code for in Manipulate Records with DML trailhead CHALLENGE, it not accepting but the output is coming correctly. Can you please guide me what is wrong in it.

Create a method for inserting accounts.
To pass this challenge, create an Apex class that inserts a new account named after an incoming parameter. If the account is successfully inserted, the method should return the account record. If a DML exception occurs, the method should return null.

The Apex class must be called AccountHandler and be in the public scope
The Apex class must have a public static method called insertNewAccount
The method must accept an incoming string as a parameter, which will be used to create the Account name
The method must insert the account into the system and then return the record
The method must also accept an empty string, catch the failed DML and then return null

https://trailhead.salesforce.com/content/learn/modules/apex_database/apex_database_dml

public class AccountHandler {

    public static id insertNewAccount(String AccountName){
        Account acc = new Account(Name = AccountName);
        Database.SaveResult srList = Database.insert(acc, false);
        System.debug('srList :'+srList.getId());
        return srList.getId();
    }
}
Hi,

I need a regular expression for the below formats allowing in text box in validation rule.

$100
200$
25%
0.25

User can directly enter the amount in doller or decimal values lessthan 1 or percentage values lessthan 100 for the discount

Please provide an regular expression to allow above formats.

Thanks in advance!
I have written below code for in Manipulate Records with DML trailhead CHALLENGE, it not accepting but the output is coming correctly. Can you please guide me what is wrong in it.

Create a method for inserting accounts.
To pass this challenge, create an Apex class that inserts a new account named after an incoming parameter. If the account is successfully inserted, the method should return the account record. If a DML exception occurs, the method should return null.

The Apex class must be called AccountHandler and be in the public scope
The Apex class must have a public static method called insertNewAccount
The method must accept an incoming string as a parameter, which will be used to create the Account name
The method must insert the account into the system and then return the record
The method must also accept an empty string, catch the failed DML and then return null

https://trailhead.salesforce.com/content/learn/modules/apex_database/apex_database_dml

public class AccountHandler {

    public static id insertNewAccount(String AccountName){
        Account acc = new Account(Name = AccountName);
        Database.SaveResult srList = Database.insert(acc, false);
        System.debug('srList :'+srList.getId());
        return srList.getId();
    }
}
I have written this class for the Trailhead challenge. I am able to find that the account gets inserted but,still I am unable to complete the challenge.Its showing the error "Executing the 'insertNewAccount' method failed. Either the method does not exist, is not static, or does not insert the proper account." Can anyone please help?

public with sharing class AccountHandler {
    public static ID insertNewAccount(String str){
        try{
            Account acc=new Account(Name='CENA');
            insert acc;      
            return(acc.Id);
            
        }
        catch(DMLException ex){
            system.debug('Error Message thrown::'+ex.getMessage());
            return(null);
            
        }
    }
}