• Ajay choudhary
  • NEWBIE
  • 0 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 15
    Replies
Hi,
  I have the following statement I want to do  the testing, System.assertEquals('Kitchen Cabinet',stockX[0].product__c );

stockX[0].product__c is a reference( a lookup field to the product), how can I get the name of the product instead of getting the reference??

Thanks,
    Jo
When I try to change the data type I receive this message:

"Changing to the selected datatype will cause you to lose all existing data in this field."

Can I just get an elaboration on exactly what data I would be losing if I went through with the change?
Hi everyone,
I am facing a problem where I am want to take the screen shot of lwc html content only , I have tried to solve this by using window.print() but that one also didnt solve my problem as this will take whole screen and  I have my lwc visual intensive so I want colour as well, but window.print() give gray image.
Is there any other way in which I can take the screenshot of lwc only in colour 
Any options would be appreciated thanks.
Hello All, I have six years of support experience, is it possible to switch to Salesforce development? If so, would you kindly offer your advice on how to accomplish this?

I cleared the Test History and ran the Code Coverage in PROD - Code Coverage: 92%
 

I did a Deployment into PROD that included a handful of Classes, all Test Classes included, using 'Run Selected Classes', all Test Classes included in Deployment, no Classes covered less that 87% in Deployment.

Check the Code Coverage in PROD afterwards: 43%
 

This makes no sense, the Code that was Deployed would be about 2% of the Apex in the Org, of which there is less than 5% maximum difference.

If we re-run the Tests in PROD again it goes back up to 91% - Why does a 'Run Selected Classes' Deployment make the Code Coverage drop?

Also noticed that the Code Coverage in PROD drops slowly over time, unless we re-run All Tests then it goes back up - What would change the Code Coverage percentage over time when no Deployments are happening in this time?

Anyone come across anything like this before?

 

Hello,
I have one method where i am inserting 10 records at a single time . Now I want after all the record is inserted then another method should be fired for all the inserted Ids at that time only . I dnot want to use for loop as the another method is having soql and some dml operations. please suggest another way. Thanks in advance.
// below I am inserting the records

   if(!recordUpdate.isEmpty()){
                for (Case multipleRecords : recordUpdate){
                	//updateChecklistRecords.putall(multipleRecords);      
                	lstUpdateChecklistRecords.add(multipleRecords)  ; 
                }
            }
            if(lstUpdateChecklistRecords.size()>0){
                insert lstUpdateChecklistRecords; 
            }


// calling the another method

             for(Case insertedRecord : lstUpdateChecklistRecords){
             	System.debug('case>>>'+insertedRecord.id);
                 AccountClass.bankload(insertedRecord.Id) // another method.
        	} 

 
I need to pull the lead owner manager's name onto our lead records. I was able to pull in the manager's user ID using this formila: Owner:User.ManagerId
But I really need the manager's name, so that I can, in turn, create a dashboard filter based off of the lead owner's manager's (ie sales teams).
On my experience cloud site the browser tab name is showing as "widget" for one of the pages. 

For the other pages the tab name shows correctly, displaying "home" or "documents" 

How do I fix this bug or manually relabel this? 
I am using lightning Data service to create a record, but doesn't work. I am new in this area, please help. After save, it gives me nothing, not even error message or alert??

createToDoRecord.cmp
==================
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId" access="global">
<!-- <aura:registerEvent name="displayRecords" type="c:displayRecords"/> -->
<aura:attribute name="ToDoTask" type="ToDo__c" default="{'sobjectType' : 'ToDo__c'}"/> <!-- <aura:attribute name="Tasks" type="List"/> -->
<aura:attribute name="recordSaveError" type="String"/>

<aura:if isTrue="{!not(empty(v.recordSaveError))}">
<div>{!v.recordSaveError}</div>
</aura:if>
<force:recordData aura:id="service" fields=
"Name,
Due_Date__c,
Reminder_Date__c,
Description__c" targetFields="{!v.ToDoTask}" targetError="{!v.recordSaveError}"
/>
<form class="slds-form--stacked slds-p-horizontal_small">
<div class="slds-box slds-theme_default">
<lightning:input name="title" label="Title" value="{!v.ToDoTask.Name}"/>
</div>
<div class="slds-box slds-theme_default">
<lightning:input name="description" label="Description" value="{!v.ToDoTask.Description__c}"/>
</div>
<div class="slds-box slds-theme_default">
<lightning:input type="date" name="due_date" label="Due Date" value="{!v.ToDoTask.Due_Date__c}"/>
</div>
<div class="slds-box slds-theme_default">
<lightning:input type="date" name="reminder_date" label="Reminder Date" value="{!v.ToDoTask.Reminder_Date__c}"/>
</div>
<lightning:layout horizontalAlign="center" class="slds-p-top_small">
<lightning:button label="submit" iconName="utility:save" iconPosition="center" onclick="{!c.onSave}"/>
</lightning:layout>
</form>

</aura:component>

createToDoRecordController.js
========================
({
onSave: function(component, event, helper){
alert("onSave");
alert(component.find("service").get());
component.find("service").saveRecord(function(saveResult){
alert("I am here");
if(saveResult.state === "SUCCESS" || saveResult.state === "DRAFT"){
alert("onSave IF SUCCESS/DRAFT");
//toast notification
var resToast = $A.get("e.force:showToast");
resToast.setParams({
"title": "Saved",
"message": "Record saved",
"type": "success"
});
resToast.fire();
helper.init(component, event, helper);
}
else if (saveResult.state === "ERROR"){
console.log("Problem Saving");
}
else if(saveResult.state === "DRAFT"){
console.log("Draft");
}
else{
alert("Other Error");
// console.log("Other Error");
}
// var eventToFire = $A.get("e.c:displayRecords");
// eventToFire.fire();
});
}
})

createToDoRecordHelper.js
=====================
({
init: function (component, event, helper) {
alert("init new task helper");
var action = component.get("c.fetchToDoTasks");
action.setCallback(this, function (response) {
var state = response.getState();
console.log(state);
// if (state === "SUCCESS") {
// component.set("v.KartTypes", response.getReturnValue());
// }
});
$A.enqueueAction(action);
}
})


 
I am facing the above issue when runnig the batch class, Any inputs will really help 

            //creating accounts 
            for(Account pacc :personAccountlist ){
                if (String.isNotBlank(pacc.Location_Name__pc) && String.isNotBlank(pacc.CT_Employee_ID__c)){
                    string locName =  pacc.Location_Name__pc.toUppercase().contains('TELEWORKER') ? 'Memorial sloan kettering - Teleworker' :'Memorial Sloan Kettering - '+ pacc.Location_Name__pc;
                    if(locationAccountMap.get(locName)==Null){
                        Account newAc = new Account();
                        newAc.Name = 'Memorial Sloan Kettering - '+ pacc.Location_Name__pc;
                        newAc.RecordTypeId=accountObjRecordTypeId;
                            newaccountMap.put(newAc.Name,newAc);
                                        
                    } 
                }
            }
            if(newaccountMap.size()>0){
                insert newaccountMap.values();
            }
            
Hi All,  I am trying to create a formula field to populate a default Account.Legal Entity (picklist) value from the Users.Legal Entity (picklist) based on the creating Users User.Legal Entity.  Example: If the User creating the Account has a Legal Entity value of 'Canada', then default the Account Legal Entity value to 'Canada' on the new Account record.

Thoughts?

Thank you!

I have a valid access token (from oauth login flow) and Contact PhotoUrl value (from a REST API call).

Is there a way to combine this two and construct a HTTP browser request that could actually allow me to fetch the image?

As per documentation, PhotoUrl returns a path to be combined with the URL of a Salesforce instance (which I also have) to generate a URL to request the profile image associated with the contact. Generated URL returns an HTTP redirect (code 302).

Everything works as long as user is logged into salesforce in the same browser session. But once the session is out, this generated URL returns 401 error instead of 302 redirect. Because I have a valid oauth access token (from some out of band way) I could pass it with the request to fetch the image.

I found some undocumented property of this PhotoUrl - if you append ?oauth_token=<valid access token> to it you will actually make the redirect and get final image url, e.g. something like https://yourInstance.salesforce.com/profilephoto/005/T

But browser cannot fetch this image, because the session is still out. Simple https://yourInstance.salesforce.com/profilephoto/005/T?oauth_token=<valid access token> would do the trick, but all query params are getting stripped during 302 redirect, and as of my knowledge there is no way to get value after the redirect from the browser.

Does anyone have any idea how browser could fetch actual image using data I mention?