• sf user 0853
  • NEWBIE
  • 10 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 6
    Replies
Should I expect value from Order to flow down to Bill to Contact on Invoice 
BillToContactId on Order -> blng__BillToContact__c on Invoice.

Any specify data field needs to be filled for value population?

I find below know issue just wanted to confirm if anyone has any workaround 
Known issue - https://trailblazer.salesforce.com/issues_view?id=a1p3A000000ATA6QAO

System.DmlException: Update failed. First exception on row 0 ; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Enter the Billing Day of Month to continue.: []
This is the error message when I am trying to create Order from Quote.


Below is my Test Class
@isTest
public class TestDataFactory {
    
    public static void createOrders() {
        Account accObj = createAccount();
        Opportunity oppObj = createOpportunity(accObj.Id);
        
        List<Product2> productList = createProduct(1);
        List<PricebookEntry> priceBookEntryList = createPricebookEntry(productList);
        
        SBQQ__Quote__c quoteObj = createQuote(accObj.Id, oppObj.Id);
        createQuoteLines(quoteObj.Id, productList.get(0).Id, priceBookEntryList.get(0).Id);
        //createQuoteLines(quoteObj.Id, productList.get(1).Id, null);
        
        quoteObj.SBQQ__Ordered__c = true;
        update quoteObj;
    }
    
    public static Account createAccount(){
        Account acc = new Account(Name = 'Test Account', Country__c = 'United States');
        insert acc;
        return acc;
    }
    
    public static Opportunity createOpportunity(Id accountId){
        Opportunity opp = new Opportunity(AccountId = accountId, 
                                          Name = 'Test Opp',
                                          CloseDate = System.today().addDays(30),
                                          StageName = 'Qualification');
        
        insert opp;
        return opp;
    }

    public static SBQQ__Quote__c createQuote(Id accountId, Id opportunityId){
        SBQQ__Quote__c quote = new SBQQ__Quote__c();
        quote.SBQQ__Account__c = accountId;
        quote.SBQQ__PricebookId__c = Test.getStandardPricebookId();
        quote.SBQQ__Opportunity2__c = opportunityId;
        quote.SBQQ__StartDate__c = System.today();
        quote.SBQQ__SubscriptionTerm__c = 12;
        quote.SBQQ__Primary__c = true;
        
        insert quote;
        return quote;
    }
    
    public static SBQQ__QuoteLine__c createQuoteLines(Id quoteId, Id productId, Id priceBookEntryId){
        SBQQ__QuoteLine__c quoteLineObj = new SBQQ__QuoteLine__c ();
        quoteLineObj.SBQQ__Quote__c = quoteId;
        quoteLineObj.SBQQ__Product__c = productId;
        quoteLineObj.SBQQ__PricebookEntryId__c = priceBookEntryId;
        quoteLineObj.SBQQ__StartDate__c = system.today();
        insert quoteLineObj;
        return quoteLineObj;
        
    }
    
    public static List<Product2> createProduct(Integer count) {
        blng__BillingRule__c brObj = new blng__BillingRule__c();
        brObj.blng__Active__c = true;
        brObj.Name = 'Test BR';
        brObj.blng__GenerateInvoices__c = 'Yes';
        brObj.blng__InitialBillingTrigger__c = 'Order Product Activation Date';
        brObj.blng__PartialPeriodTreatment__c = 'Combine';
        insert brObj;
        
        blng__RevenueRecognitionRule__c rrObj = new blng__RevenueRecognitionRule__c();
        rrObj.blng__Active__c = true;
        rrObj.blng__CreateRevenueSchedule__c = 'No';
        insert rrObj;
        
        blng__TaxRule__c taxRuleObj = new blng__TaxRule__c();
        taxRuleObj.blng__Active__c = true;
        taxRuleObj.blng__TaxableYesNo__c = 'No';
        insert taxRuleObj;
        
        List<Product2> productLists = new List<Product2>();
        for(Integer i = 0; i < count; i++) {
            Product2 product = new Product2(
                Name = 'Product '+i,
                IsActive = true, 
                SBQQ__SubscriptionPricing__c = 'Fixed Price', 
                SBQQ__SubscriptionTerm__c = 12, 
                SBQQ__SubscriptionType__c = 'Renewable',
                SBQQ__ChargeType__c = 'Recurring',
                SBQQ__BillingFrequency__c = 'Monthly',
                SBQQ__BillingType__c = 'Arrears',
                blng__BillingRule__c = brObj.Id,
                blng__RevenueRecognitionRule__c = rrObj.Id,
                blng__TaxRule__c = taxRuleObj.Id
                
            );
            productLists.add(product);
        }
   
        insert productLists;
      
        return productLists;
    }
    
    public static List<PricebookEntry> createPricebookEntry(List<Product2> productList) {
        
        List<PricebookEntry> priceBookEntryList = new List<PricebookEntry>();
        
        for(Integer i = 0; i < productList.size(); i++) {
            PricebookEntry pbEntry = new PricebookEntry(
                Pricebook2Id = Test.getStandardPricebookId(),
                Product2Id = productList.get(i).Id,
                UnitPrice = 1000,
                IsActive = true
            );
            priceBookEntryList.add(pbEntry);
        }
        insert priceBookEntryList;
        return priceBookEntryList;
    }

    
}

Any inputs would be helpful!
Thanks
  • I have created a guided setup flow for Chats of Sales
  • So new chats will be linked to Leads
  • I am using Embedded Service API for overriding this behaviour to implement my usecase
  • My use case -
    • When a new request is coming first lookup to existing Contacts if found then link it with chat
    • If existing Contacts not found then lookup to existing Leads
    • If no existing records are found then create new Lead
  • This SF implements this usecase by default when Contacts are created from converting Leads
  • My client org is having Contacts which are not converted from Leads
  • So following sript I am using to achieve this - 
    • embedded_svc.settings.extraPrechatInfo = [
                      
                      {
                          "entityName": "Contact" ,
                          "saveToTranscript " : "ContactId",
                          "entityFieldMaps": [
                              {"isExactMatch": true , "fieldName": "FirstName" , "doCreate": false , "doFind": true , "label": "First Name"} ,
                              {"isExactMatch": true , "fieldName": "Email" , "doCreate": false , "doFind": true , "label": "Email"} ,
                              {"isExactMatch": true , "fieldName": "LastName" , "doCreate": false , "doFind": true , "label": "Last Name"}
                          ]
                      } , 
                      
                      {
                          "entityName": "Lead" ,
                          "saveToTranscript " : "LeadId",
                          "entityFieldMaps": [
                              {"isExactMatch": true , "fieldName": "FirstName" , "doCreate": true , "doFind": true , "label": "First Name"} ,
                              {"isExactMatch": true , "fieldName": "Email" , "doCreate": true , "doFind": true , "label": "Email"} ,
                              {"isExactMatch": true , "fieldName": "LastName" , "doCreate": true , "doFind": true , "label": "Last Name"}
                          ]
                      }
                      
                      
                  ];
Reference link - https://developer.salesforce.com/docs/atlas.en-us.snapins_web_dev.meta/snapins_web_dev/snapins_web_prechat_code_examples.htm
Appreciate your help! Thanks in advance!
I want to update checkbox value onChange of input field value
 
Javacript
<script type="text/javascript">
    
    	function updateCheckbox(id) {          
            $(id).attr("data-id").checked = true;
        }
    
 </script>


<!- Iterating over records--->
 <apex:pageBlockTable value="List Of records" var="Obj">

 <apex:column headerValue="  ">
   <apex:inputField value="{!Obj.Check_Box__c}" html-data-id = "{!Obj.Id}"/>
 </apex:column>
</apex:pageBlockTable>

I am calling the JS function on change of inputfield and then I want to check related Checkbox 

Can you guys pls help!
Created a new trigger on Task -
trigger TaskTrigger on Task (after insert, after update, after delete) {
    
    if(trigger.isInsert || trigger.isUpdate){
        System.debug(trigger.new);   
        for(Task taskInstance : trigger.new) {
        }
    }
}
FAcing following error - Invalid loop variable type expected Task was Task


Also executing the below piece of code in execute anonymous window

for(Task t : [select id from task]) {
    System.debug(t);

Facing following error - 
Loop variable must be a generic SObject or List or a concrete SObject or List of: Task

Also, for the below code

Task t = new Task();
t.Subject = 'Test';
insert t;

Facing following error - 
Constructor not defined: [Task].<Constructor>()
I have created one screen flow that will create a Contact record from the Account object and I placed that flow on the Quick Action button.

On that screen flow, I have two text field elements and their value will be auto-populated from Account.

I want to make those two fields on-screen as ready only so the user can edit them while creating a contact from the flow and once contact got created those field is editable for those users.

How we can make the field read-only on-screen flow?

Kindly note that I don't want to change FLS. 

Early response will be highly appreciated
Thanks in advance! 

System.DmlException: Update failed. First exception on row 0 ; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Enter the Billing Day of Month to continue.: []
This is the error message when I am trying to create Order from Quote.


Below is my Test Class
@isTest
public class TestDataFactory {
    
    public static void createOrders() {
        Account accObj = createAccount();
        Opportunity oppObj = createOpportunity(accObj.Id);
        
        List<Product2> productList = createProduct(1);
        List<PricebookEntry> priceBookEntryList = createPricebookEntry(productList);
        
        SBQQ__Quote__c quoteObj = createQuote(accObj.Id, oppObj.Id);
        createQuoteLines(quoteObj.Id, productList.get(0).Id, priceBookEntryList.get(0).Id);
        //createQuoteLines(quoteObj.Id, productList.get(1).Id, null);
        
        quoteObj.SBQQ__Ordered__c = true;
        update quoteObj;
    }
    
    public static Account createAccount(){
        Account acc = new Account(Name = 'Test Account', Country__c = 'United States');
        insert acc;
        return acc;
    }
    
    public static Opportunity createOpportunity(Id accountId){
        Opportunity opp = new Opportunity(AccountId = accountId, 
                                          Name = 'Test Opp',
                                          CloseDate = System.today().addDays(30),
                                          StageName = 'Qualification');
        
        insert opp;
        return opp;
    }

    public static SBQQ__Quote__c createQuote(Id accountId, Id opportunityId){
        SBQQ__Quote__c quote = new SBQQ__Quote__c();
        quote.SBQQ__Account__c = accountId;
        quote.SBQQ__PricebookId__c = Test.getStandardPricebookId();
        quote.SBQQ__Opportunity2__c = opportunityId;
        quote.SBQQ__StartDate__c = System.today();
        quote.SBQQ__SubscriptionTerm__c = 12;
        quote.SBQQ__Primary__c = true;
        
        insert quote;
        return quote;
    }
    
    public static SBQQ__QuoteLine__c createQuoteLines(Id quoteId, Id productId, Id priceBookEntryId){
        SBQQ__QuoteLine__c quoteLineObj = new SBQQ__QuoteLine__c ();
        quoteLineObj.SBQQ__Quote__c = quoteId;
        quoteLineObj.SBQQ__Product__c = productId;
        quoteLineObj.SBQQ__PricebookEntryId__c = priceBookEntryId;
        quoteLineObj.SBQQ__StartDate__c = system.today();
        insert quoteLineObj;
        return quoteLineObj;
        
    }
    
    public static List<Product2> createProduct(Integer count) {
        blng__BillingRule__c brObj = new blng__BillingRule__c();
        brObj.blng__Active__c = true;
        brObj.Name = 'Test BR';
        brObj.blng__GenerateInvoices__c = 'Yes';
        brObj.blng__InitialBillingTrigger__c = 'Order Product Activation Date';
        brObj.blng__PartialPeriodTreatment__c = 'Combine';
        insert brObj;
        
        blng__RevenueRecognitionRule__c rrObj = new blng__RevenueRecognitionRule__c();
        rrObj.blng__Active__c = true;
        rrObj.blng__CreateRevenueSchedule__c = 'No';
        insert rrObj;
        
        blng__TaxRule__c taxRuleObj = new blng__TaxRule__c();
        taxRuleObj.blng__Active__c = true;
        taxRuleObj.blng__TaxableYesNo__c = 'No';
        insert taxRuleObj;
        
        List<Product2> productLists = new List<Product2>();
        for(Integer i = 0; i < count; i++) {
            Product2 product = new Product2(
                Name = 'Product '+i,
                IsActive = true, 
                SBQQ__SubscriptionPricing__c = 'Fixed Price', 
                SBQQ__SubscriptionTerm__c = 12, 
                SBQQ__SubscriptionType__c = 'Renewable',
                SBQQ__ChargeType__c = 'Recurring',
                SBQQ__BillingFrequency__c = 'Monthly',
                SBQQ__BillingType__c = 'Arrears',
                blng__BillingRule__c = brObj.Id,
                blng__RevenueRecognitionRule__c = rrObj.Id,
                blng__TaxRule__c = taxRuleObj.Id
                
            );
            productLists.add(product);
        }
   
        insert productLists;
      
        return productLists;
    }
    
    public static List<PricebookEntry> createPricebookEntry(List<Product2> productList) {
        
        List<PricebookEntry> priceBookEntryList = new List<PricebookEntry>();
        
        for(Integer i = 0; i < productList.size(); i++) {
            PricebookEntry pbEntry = new PricebookEntry(
                Pricebook2Id = Test.getStandardPricebookId(),
                Product2Id = productList.get(i).Id,
                UnitPrice = 1000,
                IsActive = true
            );
            priceBookEntryList.add(pbEntry);
        }
        insert priceBookEntryList;
        return priceBookEntryList;
    }

    
}

Any inputs would be helpful!
Thanks
Created a new trigger on Task -
trigger TaskTrigger on Task (after insert, after update, after delete) {
    
    if(trigger.isInsert || trigger.isUpdate){
        System.debug(trigger.new);   
        for(Task taskInstance : trigger.new) {
        }
    }
}
FAcing following error - Invalid loop variable type expected Task was Task


Also executing the below piece of code in execute anonymous window

for(Task t : [select id from task]) {
    System.debug(t);

Facing following error - 
Loop variable must be a generic SObject or List or a concrete SObject or List of: Task

Also, for the below code

Task t = new Task();
t.Subject = 'Test';
insert t;

Facing following error - 
Constructor not defined: [Task].<Constructor>()