-
ChatterFeed
-
0Best Answers
-
1Likes Received
-
0Likes Given
-
17Questions
-
0Replies
Gave wrong email when registering for Developer days
Hi Trailblazers,
I gave a wrong email when registering for salesforce developer days event. Is there any possibility to change the email Id so that i can get the invite?
-
- Rahul Allada
- July 03, 2022
- Like
- 0
- Continue reading or reply
error: Illegal assignment from Object to Map<String,String>
String input = '{"orgId":{"isRequired":"true", "valiateDataType": "Id"},"numOfVehicles":{"isRequired": "true"}}'; Map<String,object> o = (Map<String,object>) JSON.deserializeUntyped(input); map<string,Id> mapsOfIds = new map<string,Id>(); mapss.put('orgId','003J000001q24JUIAY'); for(string key : mapOfIds.keyset()){ map<string,string> mapIter = o.get(key); }
I have a code as above and i am getting the error Illegal assignment from Object to Map<String,String> at last line where i am assigning mapIter.
-
- Rahul Allada
- August 02, 2021
- Like
- 0
- Continue reading or reply
System.JSONException: Nested object for polymorphic foreign key must have an attributes field before any other fields.
My mock body looks like :
'{"totalSize": 1, "done":true, "nextRecordsUrl":"WWW.testurl.com","records":[{"Name":"Fund1", "aduro__Date_of_Inception__c":"2011-10-09 00:00:00", "Accept_ACH_Payments__c":true,"ACH_Public_Key__c":"pk_sandbox_MTU4MmJhMDgtMTU4OC00YmVh","ACH_Secret_Key__c" :"sk_sandbox_OTc0ZTVkMzQtYmM5Mi00MWU5"}]}'And my wrapper looks like this:
public class QueryResponse { public Integer totalSize {get; set;} public Boolean done {get; set;} public String nextRecordsUrl { get; set; } public List<SObject> records {get; set;} }
The SObject in my case is fund__c.
When i use i am getting the error as System.JSONException: Nested object for polymorphic foreign key must have an attributes field before any other fields.
-
- Rahul Allada
- July 04, 2021
- Like
- 0
- Continue reading or reply
How to bulkify this code? And avoid Query inside for loop
trigger dummyTrigger on Case (before insert){ if(trigger.isBefore && trigger.isInsert){ List<case> ca = new List<case>(); system.debug('Inside trigger'); for( case c: trigger.new){ if(c.Service_Type__c == 'Apply Service' && c.entitlementid==null && c.AssetId!=null) { system.debug('Inside If-'); List<servicecontract> servCon=new List<servicecontract>([select id from servicecontract where AccountId=:c.AccountId and Asset__c=:c.AssetId and sla__c=null and startdate!=null]); Entitlement ent; if(servCon.size()>0) { ent = [select id from entitlement where accountid=:c.AccountId and servicecontractid=:servCon[0].id and AssetId=:c.AssetId]; } c.entitlementid = ent.id; c.servicecontractid = servCon[0].id; } } } }
How do I bulkify this code and avoid SOQL query inside for loop?
-
- Rahul Allada
- June 22, 2021
- Like
- 0
- Continue reading or reply
How to get Id of a element using class name, or how to remove the class name?
I have an anchor tag with the class name "Active". How do I get the Id of the tag with the class name "Active"? Or how can i change the class="active" to class=" "?
<a aura:id="Home" href="{!v.status}" id ="dashboard" class="active" alternativeText="DASHBOARD" title="DASHBOARD"> </a>Please help me with this? Any one of the solutions is fine for me.
-
- Rahul Allada
- June 03, 2021
- Like
- 0
- Continue reading or reply
Problem with invoking apex class in lightning AURA
I am stuck up with calling APEX class from Aura init handler as i am new to AURA component. Can someone help me in finding where the error is:
CMP File
<aura:component implements="flexipage:availableForAllPageTypes,forceCommunity:availableForAllPageTypes" controller="SurveyController" access="global" > <aura:handler name="init" value="{!this}" action="{!c.doInit}" /> <div id="footermenu"> <div class="slds-box show-for-tablet"> <lightning:layout horizontalAlign="space" class="slds-p-top--xx-small"> <lightning:layoutItem class="slds-size_1-of-3"> <a href="/wal/s" id ="dashboard" class="" alternativeText="DASHBOARD" title="DASHBOARD"> <span class="fmcicon slds-avatar slds-avatar--medium"><img src="{!$Resource.iconfooternavDashboard}" class="slds-" alt="DASHBOARD"/></span><br/> <span class="fmctext">DASHBOARD</span> </a> </lightning:layoutItem> <lightning:layoutItem class="slds-size_1-of-3"> <a href="/wal/s/surveys" id ="surveys" alternativeText="SURVEYS" title="SURVEYS"> <span class="fmcicon slds-avatar slds-avatar--medium"><img src="{!$Resource.iconfooternavSurveys}" alt="SURVEYS"/></span><br/> <span class="fmctext">SURVEYS</span> </a> </lightning:layoutItem> <lightning:layoutItem class="slds-size_1-of-3"> <a href="/wal/s/resources" id ="resources" alternativeText="RESOURCES" title="RESOURCES"> <span class="fmcicon slds-avatar slds-avatar--medium"><img src="{!$Resource.iconfooternavResources}" alt="RESOURCES"/></span><br/> <span class="fmctext">RESOURCES</span> </a> </lightning:layoutItem> </lightning:layout> </div> <div> </div> </div> </aura:component>
JS File
({ doInit : function(component, event, helper) { console.log('Raahul Allada '+window.document.title); var status; var idd = $A.get("$SObjectType.CurrentUser.Id"); var action = component.get("c.getStatusOfSurveys"); console.log('Action is '+action); action.setParams({ "userId": idd }); action.setCallback(this, function(response){ var state = response.getState(); if(state == 'SUCCESS') { status = response.getReturnValue(); console.log('Status is '+response.getReturnValue()); } }); console.log('Status of survey 1 is '+ status['MDD-Survey-1']); $A.enqueueAction(action); } })
Apex class
public with sharing class SurveyController { @AuraEnabled public static Map<string,boolean> getStatusOfSurveys(String userId){ List<string> listOfSurveys = new List<string>{'MDD-Survey-1','MDD-Survey-2','MDD-Survey-3'}; Map<string,boolean> surveyStatus = new Map<string,boolean>(); List<User> users = [SELECT Id,contactId FROM User WHERE id = :userId]; if(users != null) { string accId = [SELECT Id, AccountId,Account.CreatedDate, Account.Name,Account.Current_wk__c,Account.Current_Wk_Session2__c,Account.GoalStartDate__c,Account.GoalStartDate_Session2__c FROM Contact WHERE id=:users[0].contactId]?.AccountId; if(accId != null){ for( Advanced_Survey_Response__c surveyResponses : [SELECT id,PLM_User__c,Status__c,Advanced_Survey__r.Survey_Number__c FROM Advanced_Survey_Response__c WHERE PLM_User__c =: accId AND Advanced_Survey__r.Survey_Number__c IN: listOfSurveys]){ boolean status = (surveyResponses.Status__c == 'Complete') ? True : False; surveyStatus.put(surveyResponses.Advanced_Survey__r.Survey_Number__c,status); } } } return surveyStatus; }}Apex class is working very fine. I am sure there is a problem with JS file only. Can someone help me in this?
-
- Rahul Allada
- June 02, 2021
- Like
- 0
- Continue reading or reply
forceChatter:feed is not working as expected
The below code is working fine and the result is as expected.
<aura:component controller="chatterController" implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" > <aura:handler name="init" action="{!c.doInit}" value="{!this}" access="global" /> <aura:attribute name="contactList" type="id" /> <forceChatter:feed type="Record" subjectId="a091y000000fXREAA2" /> //Passing Record Id directly </aura:component>Whereas if I pass the SubjectId with some attribute value, results are not getting displayed as expected.
<aura:component controller="chatterController" implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" > <aura:handler name="init" action="{!c.doInit}" value="{!this}" access="global" /> <aura:attribute name="contactList" type="id" /> <forceChatter:feed type="Record" subjectId="{!v.contactList}" /> //Passing Variable which has record-id(a091y000000fXREAA2) directly </aura:component>Not able to find what's the exact reason why the results are not displayed properly when I pass subjected with a variable which has the record Id.
-
- Rahul Allada
- February 18, 2021
- Like
- 0
- Continue reading or reply
How to write a test class for the below method?
public class quoteFlowClass {
@InvocableMethod
Public static void attachPDF(List<string> quoteId){
Blob pdfBlob;
PageReference pdfPage = Page.QuoteGeneration;
pdfPage.getParameters().put('id',quoteId[0]);
pdfBlob = pdfPage.getContentAsPDF();
id quoteIdd = quoteId[0];
List<ContentDocumentLink> quotList = [SELECT ContentDocumentId FROM ContentDocumentLink WHERE LinkedEntityId =: quoteIdd];
integer m = quotList.isEmpty() ? 0 : quotList.size();
m=m+1;
Quote__c pdfParent = [SELECT Name FROM Quote__c WHERE Id = :quoteId[0]];
ContentVersion cv = new ContentVersion(
Title=pdfParent.Name+'-V'+m+'.pdf',
PathOnClient=pdfParent.Name+'-V'+m+'.pdf',
VersionData=pdfBlob
);
insert cv;
cv = [SELECT ContentDocumentId FROM ContentVersion WHERE Id = :cv.Id];
ContentDocumentLink cdl = new ContentDocumentLink(
ContentDocumentId = cv.ContentDocumentId,
LinkedEntityId = pdfParent.Id,
ShareType = 'I', // Inferred Share
Visibility = 'AllUsers'
);
insert cdl;
}
}
I tried doing my best, but not able to cover. This class is invoked from flows as a quick action
-
- Rahul Allada
- February 10, 2021
- Like
- 0
- Continue reading or reply
To Add the values coming from a controller of VF page
I have some integer fields coming up from the controller to the Vf page. The controller looks like this:
public with sharing class QuotePDFController { public string parId; public quote__c quotesRecords {get;set;} public QuotePDFController(ApexPages.StandardController standardController){ quotesRecords = new Quote__c(); parId = standardController.getId(); quotesRecords = [select Id,Name, (SELECT Onetime_Fee__c,Number_of_Days__c,Storage_Cost__c FROM Quote_Line_Items__r) FROM Quote__c where Id =: parId ]; Quote_Line_Item__c[] qli = quotesRecords.Quote_Line_Items__r; }}
To sum up, a single quote has multiple quote line items. And I have to perform (Onetime_Fee__c * Number_of_Days__c) + Storage_Cost__c and display it on VF page for every repeat of Quotelineitems
<apex:repeat var="qli" value="{!quotesRecords.Quote_Line_Items__r}">How to do?
-
- Rahul Allada
- February 06, 2021
- Like
- 0
- Continue reading or reply
Error: Too many nested getContent calls
The code is as follows:
<apex:page action="{!attachOfferPDF}" standardController="Quote__c" extensions="QuotePDFController" readOnly="true" applyHtmlTag="false" sidebar="false" showHeader="false" cache="true" renderAs="pdf">
Apex Controller:
public with sharing class QuotePDFController { public PageReference rtn; public static string recursion = 'false' ; public string parId; public quote__c quotesRecords {get;set;} public Quote_header__mdt quotesHeaders {get;set;} public QuotePDFController(ApexPages.StandardController standardController){ quotesRecords = new Quote__c(); parId = standardController.getId(); system.debug('parid '+parId); quotesRecords = [select Id,Name, (SELECT Id, Product_Name__c,DifficultyLevel__c,Product__r.Name,Level_Course__c,Onetime_Fee__c,OS__c,Vlab_Configuration__c,PerHourCost__c,PerChallengeEvaluationFee__c FROM Quote_Line_Items__r) FROM Quote__c where Id = 'a071y0000015mwEAAQ' limit 1]; } public void attachOfferPDF() { if ( recursion == 'false'){ recursion = 'true'; system.debug(recursion); PageReference pdfPage = Page.QuoteGeneration; Blob pdfBlob = pdfPage.getContentAsPDF(); Attachment a = new Attachment(parentId = 'a071y0000015mwEAAQ', name='Rahul' + '.pdf', body = pdfBlob); insert a; system.debug('id is '+a.id); }} }
Not able to figure why this error is being thrown.
-
- Rahul Allada
- January 19, 2021
- Like
- 0
- Continue reading or reply
How to upload the pdf rendered by VF page into the files section
How to upload in files section?
-
- Rahul Allada
- January 17, 2021
- Like
- 0
- Continue reading or reply
How to get clone source Id for the records coming from database?
Insert acc;
Account acc1 = acc0.clone();
insert acc1;
System.debug(acc1.getCloneSourceId()); //Producing expected result as the record(Acc1) is in runtime memory
Account acc2 = [select id from account where id =: acc1.id];
system.debug(acc2.getCloneSourceId());//Is producing null value, as the record is retrieved from database
How to get the Clone Id of a record coming from the database?
-
- Rahul Allada
- January 09, 2021
- Like
- 1
- Continue reading or reply
isClone() not working as expected
Account acc = new account(name='Rahul');
insert acc;
account acc1 = acc.clone();
insert acc1;
Account accc = [select id from account where id =: acc1.id];
system.debug(accc.isClone());//Supposed to display true
But it is being displayed as False.
It is supposed to show true as acc1(accc) is a clone of acc
-
- Rahul Allada
- January 09, 2021
- Like
- 0
- Continue reading or reply
Data Mapped from controller is not visible in VF page
Below is my controller:
public with sharing class QuotePDFController {
public quote__c quotesRecords {get;set;}
public QuotePDFcontroller(){
quotesRecords = new Quote__c();
Quote__c quotesRecords = [select Id,Name,Lab_Request__c, (SELECT Id, Name, Product__r.Name FROM Quote_Line_Items__r) FROM Quote__c where Id =: ApexPages.currentPage().getParameters().get('id') Limit 1];
system.debug('quote isssss '+quotesRecords.Name);
}}
Below is the VF page:
<apex:page controller="QuotePDFController"
readOnly="true"
applyHtmlTag="false"
sidebar="false"
showHeader="false"
cache="true"
renderAs="advanced_pdf">
<html>
<head>
<style type="text/css">
@page {
<!--size: letter;
margin: 15mm;-->
@top-center {
content: "";
}
@bottom-right {
content: "Page " counter(page) " of " counter(pages);
}
@bottom-left {
content: "THIS IS A COMPUTER GENERATED ORDER AND NO SIGNATURE REQUIRED"
}
}
.page-break {
display: block;
page-break-after: always;
}
body {
font-family: OpenSans-Regular;
}
table{
border: 1px;
}
</style>
</head>
<body>
<table border="1" align="center" style="border-collapse: collapse;" padding="10px">
<tr style="padding-top: 5px;padding-right: 3px;padding-bottom: 5px;padding-left: 3px;">
<th>{!quotesRecords.Name} </th>
</tr>
<table>
</body>
</html>
-
- Rahul Allada
- December 30, 2021
- Like
- 0
- Continue reading or reply
How to map fields using custom metadata?
Pli.Billed__c = Prod.Billed__c;
I wonder if there is anyway i can do this dynamically using Custom metadata.
So my question goes like, for mapping fields from one object to fields of another object, is there anyway i can do it dynamically using custom Metadata?
-
- Rahul Allada
- December 16, 2020
- Like
- 0
- Continue reading or reply
How to get Id of the created record when using .submit function
this.template.querySelector('lightning-record-edit-form').submit()
and store it in a variable?
-
- Rahul Allada
- November 19, 2020
- Like
- 0
- Continue reading or reply
To query Opportunity Product using Quote line item Id
Hello Trailblazers,
I have a requirement and i am pretty much confused. Let me explain the issue in which i am confused.
I have a Quote Line Item ID(QLI ID). And with this ID i want to retrieve opportunity product records in that QLI.How do i write that query?
-
- Rahul Allada
- October 17, 2020
- Like
- 0
- Continue reading or reply
How to get clone source Id for the records coming from database?
Insert acc;
Account acc1 = acc0.clone();
insert acc1;
System.debug(acc1.getCloneSourceId()); //Producing expected result as the record(Acc1) is in runtime memory
Account acc2 = [select id from account where id =: acc1.id];
system.debug(acc2.getCloneSourceId());//Is producing null value, as the record is retrieved from database
How to get the Clone Id of a record coming from the database?
-
- Rahul Allada
- January 09, 2021
- Like
- 1
- Continue reading or reply