• Kancharla Chakravarthy
  • NEWBIE
  • 65 Points
  • Member since 2019
  • Salesforce Architect
  • Zensar

  • Chatter
    Feed
  • 2
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 9
    Replies
If I do not know what is the Object type I am handling in a method, what should be the return type of that method, Thank You 
Howdy,

I am trying to get 100% code coverage on my test class, but I am failing to write a text class that actually covers the code
 
@isTest
    static void testM3Update() {
        
        Test.setMock(HttpCalloutMock.class, new MockSetupForSpringCM());
        SFDC_Employee__c ee = [Select Id From SFDC_Employee__c];
        dsfs__Docusign_Status__c testDssRecord = new dsfs__Docusign_Status__c();
        testDssRecord.dsfs_Employee__c = ee.Id;
       	testDssRecord.dsfs__Subject__c = 'Welcome Aboard, Reg!';
        testDssRecord.dsfs__Envelope_Status__c = 'Sent';
        testDssRecord.dsfs__Sent_Date_Time__c = date.today();
        
        
        
        
        Test.startTest();
        dsfs__Docusign_Status__c otherDssRecord = new dsfs__Docusign_Status__c();
        otherDssRecord.dsfs_Employee__c = ee.Id;
       	otherDssRecord.dsfs__Subject__c = 'Welcome Aboard, Reg!';
		otherDssRecord.dsfs__Envelope_Status__c = 'Completed';
        otherDssRecord.dsfs__Sent_Date_Time__c = date.today();
        
        
        insert otherDssRecord;
        insert testDssRecord;
        List<SFDC_Employee__c> eeList = [select Id, M3_Upload__c from SFDC_Employee__c where M3_Upload__c = false AND Id =: testDssRecord.Id];
        for(SFDC_Employee__c preEe : eeList) {
			System.assert(!preEe.M3_Upload__c);            
        }
        testDssRecord.dsfs__Envelope_Status__c = 'Completed';
        update testDssRecord;
        List<SFDC_Employee__c> eeUpdated = [select Id, M3_Upload__c from SFDC_Employee__c where M3_Upload__c = true AND Id =: testDssRecord.Id];
        Test.stopTest();
        
        System.assertEquals(eeUpdated.size() > 0, false, 'There was a problem with setting M3 upload');
        for(SFDC_Employee__c m3Ee : eeUpdated) {
			System.assert(m3Ee.M3_Upload__c);            
        }
        
    }
I am having trouble covering the trigger below: 
if(Trigger.isAfter && Trigger.isUpdate) {
        Set<Id> dssSet = trigger.newMap.keySet();
        for(dsfs__Docusign_Status__c d: [Select Id, dsfs_Employee__c, dsfs__Subject__c, dsfs__Envelope_Status__c From dsfs__Docusign_Status__c Where dsfs__Subject__c LIKE 'Welcome Aboard%' AND dsfs_Employee__r.Employee_Status__c = 'A' AND dsfs__Envelope_Status__c = 'Completed' AND dsfs_Employee__r.Location__r.Payroll__c = 'Payroll' AND Id IN: dssSet]) {
            SFDC_Employee__c ee = [Select Id, M3_Upload__c From SFDC_Employee__c Where Id =: d.dsfs_Employee__c];
            ee.M3_Upload__c = true;
            update ee;
        }
    }

I am unable to get coverage on the last 3 lines of code, a simply field update. 

 
I have operating hours/time slots for one service territory as below  

Monday        9:00 AM    7:00 PM    Normal 11-05-2020
Tuesday        9:00 AM    7:00 PM    Normal 12-05-2020
Wednesday    9:00 AM    7:00 PM    Normal 13-05-2020
Thursday    9:00 AM    7:00 PM    Normal 14-05-2020
Friday        9:00 AM    7:00 PM    Normal 15-05-2020
Saturday    9:00 AM    7:00 PM    Normal 16-05-2020
Sunday        9:00 AM    7:00 PM    Normal 17-05-2020


I can see the same time slots while booking service appointment for next 15 days from today

But I want to show this week Wednesday (13-05-2020) and Thursday (14-05-2020) time slots as Emergency hours and upcoming Wednesday and Thursday as normal hours.
Is it possible through configuration or code?

Monday        9:00 AM    7:00 PM    Normal 11-05-2020
Tuesday        9:00 AM    7:00 PM    Normal 12-05-2020
Wednesday  11:00 AM 4:00 PM    Emergency 13-05-2020
Thursday   11:00 AM 4:00 PM Emergency 14-05-2020
Friday        9:00 AM    7:00 PM    Normal 15-05-2020
Saturday    9:00 AM    7:00 PM    Normal 16-05-2020
Sunday        9:00 AM    7:00 PM    Normal 17-05-2020
Monday        9:00 AM    7:00 PM    Normal 18-05-2020
Tuesday        9:00 AM    7:00 PM    Normal 19-05-2020
Wednesday    9:00 AM    7:00 PM    Normal 20-05-2020
Thursday    9:00 AM    7:00 PM    Normal 21-05-2020
Friday        9:00 AM    7:00 PM    Normal 22-05-2020
Saturday    9:00 AM    7:00 PM    Normal 23-05-2020
Sunday        9:00 AM    7:00 PM    Normal 24-05-2020
Hello Everyone,

I am working on one visualforce page where I have a text field and save button, on entering data to text field and clicking on save button, I am creating the record.

Now I want to show the newly inserted record on vf page in a table, I did created vf page and apex class but unable to show the created record on vf page.

Can anyone helps me out in this issue if possible.

Visualforce Page:
<apex:page Controller="StagingEventInsertAndShowData" lightningStylesheets="true">
    <apex:form >
        <apex:pageMessages id="pageMessages"/>
        <apex:pageBlock title="New Staging Event Attendee">
            <apex:pageBlockSection id="reRenderId">
                <apex:inputText label="Barcode" value="{!Barcode}"/>
                <apex:commandButton value="Insert" action="{!save}" reRender="reRenderId,pageBlockRecords,pageMessages"/>
            </apex:pageBlockSection>
        </apex:pageBlock>
        <apex:pageBlock title="Details of Attendees" id="pageBlockRecords">
            <apex:pageBlockTable value="{!accList}" var="a">
                <apex:column headerValue="Barcode" value="{!a.Barcode__c}"/>
                <apex:column headerValue="Attendant" value="{!a.Attendant__c}"/>
                <apex:column headerValue="Campaign" value="{!a.Campaign_ID__c}"/>
                <apex:column headerValue="Email" value="{!a.Email__c}"/>
                <apex:column headerValue="Date Attended" value="{!a.Date_Attended__c}"/>
                <apex:column headerValue="Invalid Barcode" value="{!a.Invalid_Barcode__c}"/>
            </apex:pageBlockTable>
        </apex:pageBlock>
    </apex:form>
</apex:page>
Controller:
public class StagingEventInsertAndShowData {
    public String Barcode{get;set;}
    public List<Staging_Event_Attendee__c> accList {get;set;}

    public StagingEventInsertAndShowData(){
        getStagingRecords();
    }

    public void getStagingRecords(){
        Date todayDate = Date.today() ;
        accList=[SELECT Id,Name,Barcode__c,Attendant__c,Campaign_ID__c,Email__c,Date_Attended__c,Invalid_Barcode__c FROM Staging_Event_Attendee__c LIMIT 10];
    }

    public PageReference save() {
        if(string.isNotBlank(Barcode)){
            Staging_Event_Attendee__c ac = new Staging_Event_Attendee__c();
            ac.Barcode__c = Barcode;
            insert ac;
            this.Barcode = null;
            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.CONFIRM , 'Saved Successfully'));
            getStagingRecords();
        } else {
            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.Error, 'Barcode was left blank. Please enter a barcode'));
        }
        return null;
    }
}


 
Hi All,  I just want to implement the one  session(text value) value across the multiple visual force pages and multiple controllers, Can anyone guide me on how to implement  
currently using cookies to maintain the one session value, is it correct?
I want to invoke a apex Trigger, but i want to do this using rest api. Right now i am able to get details of trigger using tooling api but i am not sure how to trigger the Apex trigger.
If I do not know what is the Object type I am handling in a method, what should be the return type of that method, Thank You 
Howdy,

I am trying to get 100% code coverage on my test class, but I am failing to write a text class that actually covers the code
 
@isTest
    static void testM3Update() {
        
        Test.setMock(HttpCalloutMock.class, new MockSetupForSpringCM());
        SFDC_Employee__c ee = [Select Id From SFDC_Employee__c];
        dsfs__Docusign_Status__c testDssRecord = new dsfs__Docusign_Status__c();
        testDssRecord.dsfs_Employee__c = ee.Id;
       	testDssRecord.dsfs__Subject__c = 'Welcome Aboard, Reg!';
        testDssRecord.dsfs__Envelope_Status__c = 'Sent';
        testDssRecord.dsfs__Sent_Date_Time__c = date.today();
        
        
        
        
        Test.startTest();
        dsfs__Docusign_Status__c otherDssRecord = new dsfs__Docusign_Status__c();
        otherDssRecord.dsfs_Employee__c = ee.Id;
       	otherDssRecord.dsfs__Subject__c = 'Welcome Aboard, Reg!';
		otherDssRecord.dsfs__Envelope_Status__c = 'Completed';
        otherDssRecord.dsfs__Sent_Date_Time__c = date.today();
        
        
        insert otherDssRecord;
        insert testDssRecord;
        List<SFDC_Employee__c> eeList = [select Id, M3_Upload__c from SFDC_Employee__c where M3_Upload__c = false AND Id =: testDssRecord.Id];
        for(SFDC_Employee__c preEe : eeList) {
			System.assert(!preEe.M3_Upload__c);            
        }
        testDssRecord.dsfs__Envelope_Status__c = 'Completed';
        update testDssRecord;
        List<SFDC_Employee__c> eeUpdated = [select Id, M3_Upload__c from SFDC_Employee__c where M3_Upload__c = true AND Id =: testDssRecord.Id];
        Test.stopTest();
        
        System.assertEquals(eeUpdated.size() > 0, false, 'There was a problem with setting M3 upload');
        for(SFDC_Employee__c m3Ee : eeUpdated) {
			System.assert(m3Ee.M3_Upload__c);            
        }
        
    }
I am having trouble covering the trigger below: 
if(Trigger.isAfter && Trigger.isUpdate) {
        Set<Id> dssSet = trigger.newMap.keySet();
        for(dsfs__Docusign_Status__c d: [Select Id, dsfs_Employee__c, dsfs__Subject__c, dsfs__Envelope_Status__c From dsfs__Docusign_Status__c Where dsfs__Subject__c LIKE 'Welcome Aboard%' AND dsfs_Employee__r.Employee_Status__c = 'A' AND dsfs__Envelope_Status__c = 'Completed' AND dsfs_Employee__r.Location__r.Payroll__c = 'Payroll' AND Id IN: dssSet]) {
            SFDC_Employee__c ee = [Select Id, M3_Upload__c From SFDC_Employee__c Where Id =: d.dsfs_Employee__c];
            ee.M3_Upload__c = true;
            update ee;
        }
    }

I am unable to get coverage on the last 3 lines of code, a simply field update. 

 
 { "requested_phoneNumber": "u7uMifPUDkJfWaNOmPbxSHZmN35Yaz7pjMo==", "otp": "12345" }
 
This is my batch class so that i was facing an error regarding the trigger firing like 
Class BirthdayNotificationBatchClass must implement the method: void Database.Batchable<SObject>.execute(Database.BatchableContext, List<SObject>)
Class BirthdayNotificationBatchClass must implement the method: void System.Schedulable.execute(System.SchedulableContext)

Please help me out from this 

Hi there,

I have a custom object called Skill Set.  Within each Skill Set there are 3 junction objects.
1. Expert At
2. Intermediate At
3. Novice At

The junction records are used to link Contact records to the Skill Set, and gives us visibility over which contacts have a speicfic level of skill. (Juntion objects have 2 lookup fields, 1 to Skill Set, 1 to Contact).

The only issue im finding with this is that I cant add more than 1 record at a time.  E.g. If i had 10 contacts that were an Expert At Skill_A, i would need to create 10 records, one at a time.  Also, if i have a Contact that has 10 skills, i have to create 10 junction records, one at a time.  This can be quite time consuming.  

Im wondering if its possible to create multiple junction records at the same time.  
E.g. 1
Im in a Contact record and want to record that the person is an Expert At 10 skills.  
I scroll to the "Expert At" reated list on the Contact and select Add New.
This returns a lookup window listing all Skills, with a checkbox next to each one, allowing me to select multiple skills.
I select 10 skills, and press OK.
This returns me to the Contact record, where i can see 10 junction Expert At related records, one for each Skill.

E.g. 2
Im in a Skill Set record, and want to add many contacts to the Skill as Experts At.
I scroll to the Expert At related list and select "Add New".
This allows me to search for and Add the 10 contacts.
I press Ok.
This returns me to the Skill Set record, where i can see 10 junction "Expert At" related records, one for each Contact.

Is this achieveable?  If so, can anyone tell me how?
 

Many thanks.  Much appreciated.

Creating Many to Many Relationships from a CSV
Hello!

I created the schema below with (two) Master Detail Fields on the Junction-Object-AB pointing to both A and B. I believe the schema is sound for my application since this is a Many to Many relationship.

Schema:
Standard Object A
Custom Object B
Junction Object AB

My question is related to uploading the data via csv. The data is coming from an internal database and each record has a unique ID (unique to the table) already so I dont have to worry about pulling back the SFDC ID after upload from the success file.

Where I am stuck is - on object B, within one record/line I have multiple record ID's in one cell pointing to the data in Object A. So an example would be:

Object A - Developer Contact
-- Tom Jones - ID - 1
-- Johnny Depp - ID - 2
-- Christina Aguilera - ID - 3

Object B - Applications
-- Angry Birds - Dev ID - 1,2,3
-- Tetris - Dev ID - 2,3

So I would need to create 3 junction records for Angry Birds and 2 junction records for Tetris based on the Developers that worked on them.
QUESTIONS
How can I create the junction records if all the ID's are in one cell?
Do all the ID's have to be loaded in a custom field and it has to be created via a trigger? (If so, some help articles or specific search topics would be appreciated. I am not a developer by trade)

I will be working with about 30K records for Object A and 30K for object B so this cannot be done manually. I would appreciate any suggestions and/or pointing me to some help articles so I can work through it.

THANK YOU!!!