• Leonard Cadet
  • NEWBIE
  • 40 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 10
    Questions
  • 7
    Replies

We've set up the domain CNAME in salesforce and our godaddy account that follows the naming convention:  
store.example.com.00dxx0000001ggxeay.live.siteforce.com
 
To pass our cert we need to follow this naming convention: _acme-challenge.store.example.com.00dxx0000001ggxeay.live.siteforce.com
 
Based on this information: https://help.salesforce.com/s/articleView?id=sf.comm_configure_cdn_and_custom_domains.htm&type=5
 
In godaddy how to I create the txt file? 
 
I have the file as Txt  Name: @   
Value: _acme-challenge.

Also I put another txt file

Name: @

Value:  _acme-challenge.store.example.com.00dxx0000001ggxeay.live.siteforce.com
 
When I put the domain name in I get an error.   Am I creating the text file correctly? 

We're creating a web to lead form. We want the lead client to put in the dimisions of their items so we have a custom master-detail on the lead that would hold the item name, length, width, hieght and lenght. If it's possible to use the product object we could use that as well.

Is there any documnation on that? 

I've written Apex classes but this is my first time written a test class. I've read a number of sources and watch videos but I don't grasp the foundation to get a test to succesfully cover my code. 

Here is my Apex class that works in my full sandbox:

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Reference Code for creating records  
//https://salesforce.stackexchange.com/questions/127889/how-to-automatically-create-a-new-record-in-another-object
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

global class MasterInventoryETL implements Schedulable {
    global void execute(SchedulableContext sc){
        List<Stock_Entry__c > Stock_E = [
            SELECT Aisle__c,Item__c,Last_Record__c,Section__c,Shelf__c,Units_in_Stock__c,units_entry__c,
            Warehouse_name__c,Account_item_owner__c,Effective_Start_Date__c,Effective_End_Date__c,
            Status__c,Stock_Location__c,Transaction_Entry__c,Transaction_Number__c,Virtual_Bin_Designation__c,
            Master_Allocation__c,P_O__c,Shipping_ID__c
            FROM Stock_Entry__c 
            WHERE last_record__c = true 
        ];
        
        List<Master_Inventory__c > snewt = new List <Master_Inventory__c>(); 
        
        
        for( Stock_Entry__c se :Stock_E){
            
            Master_Inventory__c snew = new Master_Inventory__c (
                units_entry__c = se.units_entry__c ,
                Units_in_Stock__c = se.Units_in_Stock__c,
                warehouse_name__c = se.warehouse_name__c ,
                Aisle__c = se.Aisle__c,
                Section__c = se.section__c,
                Shelf__c = se.Shelf__c,
                Status__c = se.Status__c,
                Item__c = se.Item__c,
                Account_item_owner__c =se.Account_item_owner__c,
                Effective_Start_Date__c = se.Effective_Start_Date__c,
                Effective_End_Date__c = se.Effective_End_Date__c,
                Master_Allocation__c = se.Master_Allocation__c,
                P_O__c = se.P_O__c,
                Shipping_ID__c = se.Shipping_ID__c,
                Stock_Location__c = se.Stock_Location__c,
                Transaction_Entry__c = se.Transaction_Entry__c,
                Transaction_Number__c = se.Transaction_Number__c,
                Virtual_Bin_Designation__c = se.Virtual_Bin_Designation__c,
                Power_of_One__c = 1
                
            );
            
            snewt.add(snew);
            
        }
        
        Insert snewt;
    }
    
}

Here is my test class, I have 3 tests using different sources I've read and none work:
@isTest(SeeAllData=TRUE)
Public class MasterInventoryETL_test{
    public static String CRON_EXP = '0 0 1 * * ? ';
  
   @isTest static void test1()
    {
        Stock_Entry__c s = [SELECT Id,pallet_location__c,item__c,aisle__c,shelf__c,
        Virtual_Bin_Designation__c, section__c,status__c, units_Entry__c
        FROM Stock_Entry__c WHERE Virtual_Bin_Designation__c LIKE '%Test%' Limit 1]; 
        System.assert(s != null);        
        // Create a test stock entry item based on the queried record. 
        Stock_Entry__c testStockEntry= s.clone();
        testStockEntry.Virtual_Bin_Designation__c = 'Test Stock';
        insert testStockEntry;
        // Query the test stock entry that was inserted.
        Stock_Entry__c testStockEntry2 = [SELECT Id,pallet_location__c,item__c,aisle__c,shelf__c,
        Virtual_Bin_Designation__c, section__c,status__c, units_Entry__c
        FROM Stock_Entry__c WHERE Virtual_Bin_Designation__c='Test Stock' LIMIT 1];
        System.assert(testStockEntry2 != null);
        
    }
    @isTest static void test2() {
        Account acc = new Account();
        acc.name ='Test';
        acc.RecordTypeID = '012j0000000pirBAAQ';
        insert acc;
        Sourcing_Item__c sitem = new Sourcing_Item__c();
        sitem.name = 'test mitem';
        sitem.Unit_of_measure__c = 'unit';
        sitem.Account_Owner__c = acc.id;
        insert sitem;
        Stock_Entry__c sec = new Stock_Entry__c();
        sec.Virtual_Bin_Designation__c = 'test';
        sec.units_Entry__c = 0;
        sec.item__c = sitem.Id;
        sec.status__c = 'In hand';
        insert sec;
        Test.startTest(); 
        MasterInventoryETL mItest = new MasterInventoryETL();
        mItest.execute(null);
        Test.stopTest(); 
    }
    @isTest static void test3() {
        Account acc = new Account();
        acc.name ='Test';
        acc.RecordTypeID = '012j0000000pirBAAQ';
        insert acc;
        Sourcing_Item__c sitem = new Sourcing_Item__c();
        sitem.name = 'test mitem';
        sitem.Unit_of_measure__c = 'unit';
        sitem.Account_Owner__c = acc.id;
        insert sitem;
        Stock_Entry__c sec = new Stock_Entry__c();
        sec.Virtual_Bin_Designation__c = 'test';
        sec.units_Entry__c = 0;
        sec.item__c = sitem.Id;
        sec.status__c = 'In hand';
        insert sec;
        test.startTest();
        String jobId = System.schedule('MasterInventoryETL',  CRON_EXP,  new MasterInventoryETL()); 
        Test.stopTest(); 
    }

}


Any help would be apperciated. I am making test data to be used in the test method but I'm not even sure what data points I should make, how to make test data or how to confirm I'm creating things properly.
Currently Price Rules we have set up aren't working. It looks like we need to set up a Quote Calculator Plugin using custom code to have price rules checked passed on the critera of a quote line. So far I did reasearch and found this:
https://developer.salesforce.com/docs/atlas.en-us.cpq_dev_plugins.meta/cpq_dev_plugins/cpq_dev_jsqcp_methods.htm 

It discribes the different methods needed to create your QuoteCalculator Plug In. Below is how I put the code in the custom scripts:
 
export function onInit(quoteLineModels) {
return Promise.resolve();
};

export function onBeforeCalculate(quoteModel, quoteLineModels ) {
return Promise.resolve();
};

export function onBeforePriceRules(quoteModel, quoteLineModels ) {
return Promise.resolve();
};

export function onAfterPriceRules(quoteModel, quoteLineModels ) {
return Promise.resolve();
};

export function onAfterCalculate(quoteModel, quoteLineModels) {
return Promise.resolve();
};
Also attached is me putting lines that should be refeenced (I'm basically guessing at this point)
User-added image
But when I go to edit lines I get the following error:
Cannot read property 'replace' of null

How do I set up the plug in so price rules that are created are checked and updated accordingly? 
I am trying to create a loop that creates pallet locations and puts that information into a record. 

The first loop goes through the Section which is 1 to 46
The nested loop goes through the Aisle which is A to Q

I expect to start with the first section and then complete all the aisle before going back to iterating the through the Section again 

So when the loop starts I expected it to start the section at 1 and loop through the Aisle like so:
A1A
B1A
C1A
etc
then once it hits q it loops out, increases the section by 1 and does the nested loop again
A2A
B2A
C2A 
Can I get feedback on my code? 
List<Stock_Location__c > slnewt = new List <Stock_Location__c>();
StringBuilder sb = new StringBuilder();

for (Integer i = 1; j = 0; i < 46; i++) {

    for(char alphabet = 'a'; alphabet <= 'q'; alphabet++) {
    Stock_Location__c slnewt = new Stock_Location__c(
    Aisle__c = sb.append(alphabet),
    Section__c = i ,
    Shelf__c = 'a',
    barcode__c = sb.append(alphabet) + i + 'a',
    Location_Name__c =   sb.append(alphabet) + '-'  i+ '-'+ 'a'   
    );
    }

    slnewt.add(slnew);
}

Insert slnewt;

 
I am working on building the framework to use a variable that is passed from a button to a flow and then from the flow to Apex code so I can use that variable in my soql query statment in my Apex code. 

What do I need to correct in my code to make this possible?
 
Public class TestLC {


    @InvocableMethod(
    label = 'Test Invoc'
    description = 'This is this is a test to confirm I can pull put info into into a variable'
    )
 
    List<CCMI__Milestone_Task__c> TempTask = 
    [SELECT 
    CCMI__Milestone_Project__c,
    Id,
    Name 
    FROM CCMI__Milestone_Task__c WHERE CCMI__Milestone_Project__c = :LCID
     ];

     For(CCMI__Milestone_Task__c TT:TempTask){
       System.debug(LCID); 
       System.debug(LGID);
       System.debug(TT.Id);
    }


    global class RecordRequest{

        @InvocableVariable(required=true)
        global String LCID;

        @InvocableVariable(required=true)
        global String LGID;
    }

   
    
}

 
I have Apex Code that I execute in the annoymous block that completes a task for me. 

We are in lightning and I want to create a button that that a user can click to execute the apex code. 

I believe I need to create a lightning component to call the apex code. 

What are the stand steps that I can follow for this process? I've been looking for documention and best practice but I'm not sure what to follow to accomplish this. 


 
In Apex, how do a append text to an existing field? 

When I run the below code I get the error I listetd in the title:

Unexpected token '&lt;'.

I believe it is my syntax but I can't see a debug log that directs me to a line in my code that is listing the issue. 

Below is the code I am trying to run. 

List<CCMI__Milestone_Project__c> CCMIProject = 
    [SELECT 
    CCMI__Opportunity__c,
    Id 
    FROM CCMI__Milestone_Project__c WHERE id = a6X3D000000OVfGUAW
     ];

List<CCMI__Milestone_Task__c> CCMITask = 
    [SELECT 
    CCMI__Milestone_Project__c,
    Id,
    Name 
    FROM CCMI__Milestone_Task__c WHERE Project__c = a6X3D000000OVfGUAW 
     ];

List<CCMI__Milestone_Task__c> TempTask = 
    [SELECT 
    CCMI__Milestone_Project__c,
    Id,
    Name 
    FROM CCMI__Milestone_Task__c WHERE Project__c = a6X3D000000OVerUAG
     ];

List<Department_To_Task__c> DeptTask = 
    [SELECT 
    Id,
    Milestone_Task__c,
    Name 
    FROM Department_To_Task__c
     ];

List<Opportunity> Oppo = 
    [SELECT 
    Id 
    FROM Opportunity WHERE id = 0063D00000AudqdQAB
     ];

List<OpportunityTeamMember> OppoTeam = 
    [SELECT 
    Id,
    Name,
    OpportunityId,
    TeamMemberRole 
    FROM OpportunityTeamMember WHERE OpportunityId = 0063D00000AudqdQAB  
     ];

List<CCMI__Milestone_Assignment2__c> Assign =
    [SELECT CCMI__Assignee_Name__c,CCMI__Milestone_Task__c 
    FROM CCMI__Milestone_Assignment2__c     
    ];

     
    for(CCMI__Milestone_Task__c TT:TempTask){

        for (CCMI__Milestone_Task__c CT:CCMITask){

            for(Department_To_Task__c DT:DeptTask){

                for(OpportunityTeamMember OT:OppoTeam){

                    if(TT.Name == CT.Name && OT.TeamMemberRole == DT.Name )     
                    {
                        Assignment sign = new sign (
                        Assign.CCMI__Assignee_Name__c = OT.Name;
                        Assign.CCMI__Milestone_Task__c = CT.Id;
                        System.debug('** True **'); 
                       )
                        insert sign;
                    }
             }
          }
        }
      }



update Assign;

I'm new to apex and coding in general and I'm looking for a place to talk out an issue so I can find the way to find the solution. I'm open to being given content to read to help me become better to resolve that problem. I'm also open to answer any question to the best of ability in case I'm not clear in my explaination 

I'm trying to create nested loops that compair IDs to other arrays.

The first loop will grab the first ID from the first object. Then compare a value to another objects array. 

Then pass both IDs and do a comparison again. 

Here's a snippet of the code I'm working on that is suppose to loop through everything.

It comes down to how can I pass the TT varaible from the TempTask array variable into the next loop to be used to compare a value. 

   for(CCMI__Milestone_Task__c TT:TempTask){
        for (CCMI__Milestone_Task__c CT:CCMITask){
            for(Department_To_Task__c DT:DeptTask){
               
          }
        }
      }

We've set up the domain CNAME in salesforce and our godaddy account that follows the naming convention:  
store.example.com.00dxx0000001ggxeay.live.siteforce.com
 
To pass our cert we need to follow this naming convention: _acme-challenge.store.example.com.00dxx0000001ggxeay.live.siteforce.com
 
Based on this information: https://help.salesforce.com/s/articleView?id=sf.comm_configure_cdn_and_custom_domains.htm&type=5
 
In godaddy how to I create the txt file? 
 
I have the file as Txt  Name: @   
Value: _acme-challenge.

Also I put another txt file

Name: @

Value:  _acme-challenge.store.example.com.00dxx0000001ggxeay.live.siteforce.com
 
When I put the domain name in I get an error.   Am I creating the text file correctly? 

I've written Apex classes but this is my first time written a test class. I've read a number of sources and watch videos but I don't grasp the foundation to get a test to succesfully cover my code. 

Here is my Apex class that works in my full sandbox:

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Reference Code for creating records  
//https://salesforce.stackexchange.com/questions/127889/how-to-automatically-create-a-new-record-in-another-object
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

global class MasterInventoryETL implements Schedulable {
    global void execute(SchedulableContext sc){
        List<Stock_Entry__c > Stock_E = [
            SELECT Aisle__c,Item__c,Last_Record__c,Section__c,Shelf__c,Units_in_Stock__c,units_entry__c,
            Warehouse_name__c,Account_item_owner__c,Effective_Start_Date__c,Effective_End_Date__c,
            Status__c,Stock_Location__c,Transaction_Entry__c,Transaction_Number__c,Virtual_Bin_Designation__c,
            Master_Allocation__c,P_O__c,Shipping_ID__c
            FROM Stock_Entry__c 
            WHERE last_record__c = true 
        ];
        
        List<Master_Inventory__c > snewt = new List <Master_Inventory__c>(); 
        
        
        for( Stock_Entry__c se :Stock_E){
            
            Master_Inventory__c snew = new Master_Inventory__c (
                units_entry__c = se.units_entry__c ,
                Units_in_Stock__c = se.Units_in_Stock__c,
                warehouse_name__c = se.warehouse_name__c ,
                Aisle__c = se.Aisle__c,
                Section__c = se.section__c,
                Shelf__c = se.Shelf__c,
                Status__c = se.Status__c,
                Item__c = se.Item__c,
                Account_item_owner__c =se.Account_item_owner__c,
                Effective_Start_Date__c = se.Effective_Start_Date__c,
                Effective_End_Date__c = se.Effective_End_Date__c,
                Master_Allocation__c = se.Master_Allocation__c,
                P_O__c = se.P_O__c,
                Shipping_ID__c = se.Shipping_ID__c,
                Stock_Location__c = se.Stock_Location__c,
                Transaction_Entry__c = se.Transaction_Entry__c,
                Transaction_Number__c = se.Transaction_Number__c,
                Virtual_Bin_Designation__c = se.Virtual_Bin_Designation__c,
                Power_of_One__c = 1
                
            );
            
            snewt.add(snew);
            
        }
        
        Insert snewt;
    }
    
}

Here is my test class, I have 3 tests using different sources I've read and none work:
@isTest(SeeAllData=TRUE)
Public class MasterInventoryETL_test{
    public static String CRON_EXP = '0 0 1 * * ? ';
  
   @isTest static void test1()
    {
        Stock_Entry__c s = [SELECT Id,pallet_location__c,item__c,aisle__c,shelf__c,
        Virtual_Bin_Designation__c, section__c,status__c, units_Entry__c
        FROM Stock_Entry__c WHERE Virtual_Bin_Designation__c LIKE '%Test%' Limit 1]; 
        System.assert(s != null);        
        // Create a test stock entry item based on the queried record. 
        Stock_Entry__c testStockEntry= s.clone();
        testStockEntry.Virtual_Bin_Designation__c = 'Test Stock';
        insert testStockEntry;
        // Query the test stock entry that was inserted.
        Stock_Entry__c testStockEntry2 = [SELECT Id,pallet_location__c,item__c,aisle__c,shelf__c,
        Virtual_Bin_Designation__c, section__c,status__c, units_Entry__c
        FROM Stock_Entry__c WHERE Virtual_Bin_Designation__c='Test Stock' LIMIT 1];
        System.assert(testStockEntry2 != null);
        
    }
    @isTest static void test2() {
        Account acc = new Account();
        acc.name ='Test';
        acc.RecordTypeID = '012j0000000pirBAAQ';
        insert acc;
        Sourcing_Item__c sitem = new Sourcing_Item__c();
        sitem.name = 'test mitem';
        sitem.Unit_of_measure__c = 'unit';
        sitem.Account_Owner__c = acc.id;
        insert sitem;
        Stock_Entry__c sec = new Stock_Entry__c();
        sec.Virtual_Bin_Designation__c = 'test';
        sec.units_Entry__c = 0;
        sec.item__c = sitem.Id;
        sec.status__c = 'In hand';
        insert sec;
        Test.startTest(); 
        MasterInventoryETL mItest = new MasterInventoryETL();
        mItest.execute(null);
        Test.stopTest(); 
    }
    @isTest static void test3() {
        Account acc = new Account();
        acc.name ='Test';
        acc.RecordTypeID = '012j0000000pirBAAQ';
        insert acc;
        Sourcing_Item__c sitem = new Sourcing_Item__c();
        sitem.name = 'test mitem';
        sitem.Unit_of_measure__c = 'unit';
        sitem.Account_Owner__c = acc.id;
        insert sitem;
        Stock_Entry__c sec = new Stock_Entry__c();
        sec.Virtual_Bin_Designation__c = 'test';
        sec.units_Entry__c = 0;
        sec.item__c = sitem.Id;
        sec.status__c = 'In hand';
        insert sec;
        test.startTest();
        String jobId = System.schedule('MasterInventoryETL',  CRON_EXP,  new MasterInventoryETL()); 
        Test.stopTest(); 
    }

}


Any help would be apperciated. I am making test data to be used in the test method but I'm not even sure what data points I should make, how to make test data or how to confirm I'm creating things properly.
I am trying to create a loop that creates pallet locations and puts that information into a record. 

The first loop goes through the Section which is 1 to 46
The nested loop goes through the Aisle which is A to Q

I expect to start with the first section and then complete all the aisle before going back to iterating the through the Section again 

So when the loop starts I expected it to start the section at 1 and loop through the Aisle like so:
A1A
B1A
C1A
etc
then once it hits q it loops out, increases the section by 1 and does the nested loop again
A2A
B2A
C2A 
Can I get feedback on my code? 
List<Stock_Location__c > slnewt = new List <Stock_Location__c>();
StringBuilder sb = new StringBuilder();

for (Integer i = 1; j = 0; i < 46; i++) {

    for(char alphabet = 'a'; alphabet <= 'q'; alphabet++) {
    Stock_Location__c slnewt = new Stock_Location__c(
    Aisle__c = sb.append(alphabet),
    Section__c = i ,
    Shelf__c = 'a',
    barcode__c = sb.append(alphabet) + i + 'a',
    Location_Name__c =   sb.append(alphabet) + '-'  i+ '-'+ 'a'   
    );
    }

    slnewt.add(slnew);
}

Insert slnewt;

 
In Apex, how do a append text to an existing field? 

When I run the below code I get the error I listetd in the title:

Unexpected token '&lt;'.

I believe it is my syntax but I can't see a debug log that directs me to a line in my code that is listing the issue. 

Below is the code I am trying to run. 

List<CCMI__Milestone_Project__c> CCMIProject = 
    [SELECT 
    CCMI__Opportunity__c,
    Id 
    FROM CCMI__Milestone_Project__c WHERE id = a6X3D000000OVfGUAW
     ];

List<CCMI__Milestone_Task__c> CCMITask = 
    [SELECT 
    CCMI__Milestone_Project__c,
    Id,
    Name 
    FROM CCMI__Milestone_Task__c WHERE Project__c = a6X3D000000OVfGUAW 
     ];

List<CCMI__Milestone_Task__c> TempTask = 
    [SELECT 
    CCMI__Milestone_Project__c,
    Id,
    Name 
    FROM CCMI__Milestone_Task__c WHERE Project__c = a6X3D000000OVerUAG
     ];

List<Department_To_Task__c> DeptTask = 
    [SELECT 
    Id,
    Milestone_Task__c,
    Name 
    FROM Department_To_Task__c
     ];

List<Opportunity> Oppo = 
    [SELECT 
    Id 
    FROM Opportunity WHERE id = 0063D00000AudqdQAB
     ];

List<OpportunityTeamMember> OppoTeam = 
    [SELECT 
    Id,
    Name,
    OpportunityId,
    TeamMemberRole 
    FROM OpportunityTeamMember WHERE OpportunityId = 0063D00000AudqdQAB  
     ];

List<CCMI__Milestone_Assignment2__c> Assign =
    [SELECT CCMI__Assignee_Name__c,CCMI__Milestone_Task__c 
    FROM CCMI__Milestone_Assignment2__c     
    ];

     
    for(CCMI__Milestone_Task__c TT:TempTask){

        for (CCMI__Milestone_Task__c CT:CCMITask){

            for(Department_To_Task__c DT:DeptTask){

                for(OpportunityTeamMember OT:OppoTeam){

                    if(TT.Name == CT.Name && OT.TeamMemberRole == DT.Name )     
                    {
                        Assignment sign = new sign (
                        Assign.CCMI__Assignee_Name__c = OT.Name;
                        Assign.CCMI__Milestone_Task__c = CT.Id;
                        System.debug('** True **'); 
                       )
                        insert sign;
                    }
             }
          }
        }
      }



update Assign;

I'm new to apex and coding in general and I'm looking for a place to talk out an issue so I can find the way to find the solution. I'm open to being given content to read to help me become better to resolve that problem. I'm also open to answer any question to the best of ability in case I'm not clear in my explaination 

I'm trying to create nested loops that compair IDs to other arrays.

The first loop will grab the first ID from the first object. Then compare a value to another objects array. 

Then pass both IDs and do a comparison again. 

Here's a snippet of the code I'm working on that is suppose to loop through everything.

It comes down to how can I pass the TT varaible from the TempTask array variable into the next loop to be used to compare a value. 

   for(CCMI__Milestone_Task__c TT:TempTask){
        for (CCMI__Milestone_Task__c CT:CCMITask){
            for(Department_To_Task__c DT:DeptTask){
               
          }
        }
      }