• Gulafsha Mohammed
  • 90 Points
  • Member since 2018

  • Chatter
  • 3
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
  • 35
I am displaying account records in one section with a checkbox.  Now I want to add selected records to another section on the same page. 

I have a question about Salesforce Files. We have a test group of users now working in Lightning Experience. One particular tester would like to use Salesforce Files. I have downloaded the application called Magic Mover for Notes and Attachments to Lightning Experience. Before I move forward with the migration process I'm wondering what if any impact this will have on those users outside the test group who are still working in Salesforce Classic? 
I'm trying to export a Visualforce page as an Excel document.

I've looked at similar questions and the exported file is saved as a webpage embedded in excel which is prompted as unsupported/corrupt in mobile devices.

It was suggested to use html tags instead of visualforce ones to enforce proper format but this also didn't work. Below is the sample table code in the VF page.

Any thoughts? Thanks.
<apex:page id="Stock_Flexible2"
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
            <table style="width:100%">

            <h1> Sample Table </h1>

                <td>b No</td>

                <apex:repeat value="{!flexibleStocks}" var="flex">

                        <td width="%10"> {!flex.Order_Serial__c}  </td>

                        <td width="10%">  {!flex.Order_No__c} </td>

                        <td width="10%"> {!flex.Queue__c} </td>

Hi All,

I want to navigate a new button to VF page navigation in Lightning. I think here we need to create a component but can you please help me with a component creation and navigating to VF page.

Hi all,

We are trying to show information through a community which contains data from Account object. As you may know there is profile for a guest user who can access to Salesforce externally and allow external customers navigating to our community, the thing we want to extend the access for query some accounts (Stores in our cases) but  I am concerned about the security by allowing access to the account object (even read-only) for people with public access to the site. We are thinking to create a specific object to replicate the information which is only needed from Account and then enable public access Read-Only to that one.

What would you consider the best approach to full-fill this requirement ? Have you ever struggled with such as implementation ?

Thanks in advance for any hint you can share.
Apex class:-
    public static String updatecase(String caseId, String accountId, String results)
        Set<String> loffinstr = new Set<String>();
        List<XXX> DFFlist= new list<XXX>([SELECT Number__c FROM XXX WHERE Case__c =:CaseId ]);
        for(XXX finfo : DFFlist ){
        List<XXX>  lstpss= new List<XXX>();
        List<Object> fieldList = (List<Object>)JSON.deserializeUntyped(results);
        if(!fieldList.isEmpty()) {
            for(Object fld : fieldList){    
                Map<String,Object> data = (Map<String,Object>)fld;
                if(!loffinstr.contains(String.valueOf(data.get('key2'))))  {    
                    XXX FFrecs = new XXX();
                    FFrecs.Case__c = caseId;
                    FFrecs.Account__c = accountId;
                    FFrecs.Name = String.valueOf(data.get('key0'));
        insert  lstpss;

    Helper class :-

        //call apex class method
        var action = component.get('c.updatecase');
            //var objList = component.get("v.selectedpss");
            var myMap = component.get("v.selectedpss");
            console.log('type 2-' + typeof myMap);
            console.log('ValuesOfmyMap' +JSON.stringify(myMap));
                "caseId": component.get("v.CaseId"),
                "accountId" : component.get("v.AccountId"),
                "results" : JSON.stringify(myMap)

Especially tell me how to pass the parameter(caseid,accountid,results) which is in Helper to Apex test class
I'm relatively new to salesforce development, and am not sure if the data loader is the best tool for what I'm trying to do, or if I should write something custom using the salesforce apis.

Basically, we have a service management platform (sage) that I believe uses SQL, that we need to import data from into salesforce nightly. We are only concerned with a one-way sync, and should only need to import records once. There are a couple different objects we'll be importing into, and it's possible that some objects (accounts) may already exist, in which case they would be ignored. Also, we'd like to do some sort of fuzzy matching to prevent duplicates, which appears to be available in salesforce, but I'm not sure what kind of interaction that has with the data loader. We'll also need to do things like translate values from the source system into picklist values in salesforce, but I imagine things like that are supported out of the box in the data loader. I've looked into the data loader cli implementation, but I'm worried that we might get hung up on not being able to support one or more of the above requirements, which has me leaning to something custom (which still shouldn't be terrible I imagine). If anyone has any wisdom they'd like to share, that would be greatly appreciated!
I am displaying account records in one section with a checkbox.  Now I want to add selected records to another section on the same page. 

How many rows and variables at minimum are needed to get a successful einstein prediciton
Hello everyone. 

I am currently working on a task where I need the comment box on my page to expand dynamically as a user types. I have the current code in my cmp file. Would I need to include "onkeyup=AutoGrow" to the cmp file? I hope I explained this correctly. Thank you for any help!

                    <div onkeypress="{!c.handleEnterKey}"
                        <lightning:textarea maxlength="400" 
                            placeholder="Write a comment..." 
                            class="llr-ltng-form-ele hide-label disabled-err-msg case-comment-textarea"
                            disabled="{!v.caseType == 'Item' || v.isSubmitting}"
I have a question about Salesforce Files. We have a test group of users now working in Lightning Experience. One particular tester would like to use Salesforce Files. I have downloaded the application called Magic Mover for Notes and Attachments to Lightning Experience. Before I move forward with the migration process I'm wondering what if any impact this will have on those users outside the test group who are still working in Salesforce Classic? 
Hi All,

I have two visual force page as seen below,

<apex:page tabStyle="Case" action="/500?fcf=00B7F00000287BO" ></apex:page>
<apex:page showHeader="true" tabstyle="Case" action="/500?fcf=00B0l0000010NyT"></apex:page>

Is there a way to club these two VF page into one. I tried Apex: Include but doesn't work.

I heard about iframe, but I don't have any idea on this.

Can someone help me to achieve this one?

Thanks in advance.

Im using two Vf pages and 1 custom controller.first page has send button.When i click send button it should send  second page as email attachment.In attachments records are not visible. Could anyone resolve this?
public Pagereference sendmail(){
         pagereference pdf;
        OrdList=[selectid,name,Total_Quantity_in_Sets__c,Order_Amount__c,Order_Date__c,Distributor__r.Email__c,Retailer_O__r.name,Order_Type__c,(select id,name,Quantity__c,Remarks__c,MRP__c,Product__r.Item_Code__c,Product__r.Remarks__c,Product__r.Tube_Weight_gm__c,Product__r.Unit_In_Dozens__c,Product__r.name from Order_Line_Items__r) from Order_C__c where Order_Date__c>=:fromdate1 AND Order_Date__c<=:todate1 AND Distributor__c=:Selecteddistri AND Order_Type__c=:'Secondary Order'];List<String> lstselectedRecordIds = new List<String>();for(Order_C__c  o:OrdList){ wrapOrder w=new wrapOrder();
    system.debug('WRRRRRRRRRRAPLIST'+WrapList); }for(wrapOrder wo:WrapList){
    for(Order_Line_Item_C__c  o:wo.OLlist1){
    wrapOrderSummary w1=new wrapOrderSummary();
    mapWS1.put(o.Product__r.name,w1); }}for(Order_Line_Item_C__c ws:ollist){
    if(mapWS1.containsKey(ws.Product__r.name)){mapWS1.get(ws.Product__r.name).Quant= mapWS1.get(ws.Product__r.name).Quant+ws.Quantity__c;
      mapWS1.get(ws.Product__r.name).price= mapWS1.get(ws.Product__r.name).price+ws.MRP__c;} }for(wrapOrderSummary w2:mapWS1.Values())
            { WSumlist.add(w2);}for(Integer i=0;i<OrdList.size();i++){
string s='';
for(Integer i=0;i<lstselectedRecordIds.size();i++)if(i<lstselectedRecordIds.size()-1)
else s=s+lstselectedRecordIds[i];}acc1=[select id,name,Email__c from Account where id=:selecteddistri];
system.debug('ACCCCCCCCCCC'+acc1);user u=[select id,name,manager.email,manager.name,managerid from user whereid=:userinfo.getuserid()];
if(u.managerid!=null){ u1=[select id,name,email,manager.email from user where id=:u.managerid ];}
{ Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
         Messaging.EmailFileAttachment attach = new Messaging.EmailFileAttachment(); Blob body;

        // Who you are sending the email to
           List<String> sendTo = new List<String>();
          mail.setHtmlBody('<p>Dear '+u.manager.name+', <br/><br/> The below are the orders in between '+fromdate1.day()+'-'+fromdate1.month()+'-'+fromdate1.year()+' to '+todate1.day()+'-'+todate1.month()+'-'+todate1.year()+'.<br/><br/></p>'pdf= Page.Distributororderpdf;
                body = pdf.getContentAsPDF();
               mail.setFileAttachments(new Messaging.EmailFileAttachment[] { attach }); Messaging.sendEmail(new Messaging.SingleEmailMessage[] {mail});emailflag=true;

}catch(Exception e) {}
return pdf;
1st VF page:

<table width="100%"><tr><td>
               <div align="center">
               <apex:outputpanel id="op3" rendered="{!emailflag=false}"><apex:commandButton value="Send" action="{!sendmail}" styleclass="slds-button slds-button_neutral" /> &nbsp;&nbsp;
               <apex:commandButton value="Cancel" action="{!Cancel}" styleclass="slds-button slds-button_neutral" /> &nbsp;&nbsp;</apex:outputpanel>

2nd VF page

<table border="1" cellspacing="0" cellpadding="3" width="80%" rendered="{!orderflag=true}" > 

            <apex:variable value="{!1}" var="count"/>
             <apex:repeat value="{!OrdList}" var="w1">

               <td align="left" style="text-align:left;font-weight:bold" colspan="4" >
               Retailer Name: {!w1.Retailer_O__r.name}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </td>

                <td align="center" style="text-align:center;font-weight:bold;" width="25%">Order Number : {!w1.name}</td>
                <td align="center" style="text-align:center;font-weight:bold;" width="25%">Order Date : &nbsp;
                 <apex:outputtext value="{0,date,MM/dd/yy}"><apex:param value="{!w1.Order_Date__c}" /></apex:outputtext></td>
                <td align="center" style="text-align:center;font-weight:bold;" width="25%">Total Qty : {!w1.Total_Quantity_in_Sets__c}</td>
                <td align="center" style="text-align:center;font-weight:bold;" width="25%">Total Value :{!w1.Order_Amount__c}</td>
              <td colspan="4">
                    <td style="text-align:center;font-weight:bold;" width="12%"></td>

                    <td style="text-align:center;font-weight:bold;" width="12%">Product Code</td>
                    <td style="text-align:center;font-weight:bold;" width="12%">Product Name</td>

                    <td style="text-align:center;font-weight:bold;" width="12%">Price</td>
                    <td style="text-align:center;font-weight:bold;" width="12%">Quantity</td>
                   <apex:repeat value="{!ollist}" var="o">
                    <td style="text-align:center;font-weight:bold;" width="12%"></td>

                  <td width="12%" style="text-align:center;">{!o.Product__r.Item_Code__c}</td>
                    <td width="12%" style="text-align:center;">{!o.Product__r.Name}</td>
                    <td width="12%" style="text-align:center;">{!o.MRP__c}</td>
                    <td width="12%" style="text-align:center;">{!o.Quantity__c}</td>


              <apex:variable value="{!Count+1}" var="count"/>

  • October 05, 2018
  • Like
  • 0
Hi All,

I am having one 3 object 
Note:- Account and SalesPreson__c object is not related to each other directly.
1. Account (Country__c, State__C)
2. SalesPreson__c(Country__c,State__C)
2. Opportunity( Opportunity object having Account & SalesPreson__c is lookup field)
my scenario is if the user is selecting Account and if Account country is India & State is Delhi then the second lookup field that is SalesPreson__c in this lookup search page in need to display only that Salesperson name which belongs from country India and State  Delhi.

Please, tell me how can I achieve this using trigger.
Thanks in advance.
It's very urgent.

Hi All,
my test class is as below:-
private class ContentDocumentLinkTriggerHelperTest {
    static void ContentDocumentLinkTriggerHelperTestMethod()
        Account acc = new Account(name='test acc');
        insert acc;
        Contact con = new Contact(lastname='test cont',accountid=acc.id);
        insert con;
        Opportunity opp = new Opportunity(name='testoppty',AccountId=acc.id,stageName='Qualification',closedate=system.today());
        insert opp;
        ContentVersion content=new ContentVersion(); 
        content.PathOnClient='/' + content.Title + '.jpg'; 
        Blob bodyBlob=Blob.valueOf('Unit Test ContentVersion Body'); 
        content.origin = 'H';
        insert content;
        ContentVersion testContent = [SELECT id, ContentDocumentId FROM ContentVersion where Id = :content.Id];
        List<ContentDocument> documents = [SELECT Id, Title, LatestPublishedVersionId FROM ContentDocument LIMIT 1];
        System.assertEquals(documents.size(), 1);
        System.assertEquals(documents[0].LatestPublishedVersionId, content.Id);
        System.assertEquals(documents[0].Title, content.Title);
        ContentDocumentLink contentlink=new ContentDocumentLink();
        contentlink.ShareType = 'V';
        insert contentlink;
        SocialPost sp = new SocialPost(Name= 'image');
        insert sp;
        String tags = 'test tags';
        Map<String,id> predictionTags = new Map<String, id>();
        List<ApiLog__c> apiLogsList = new List<ApiLog__c>();
        set<id> SocialPostIds = new Set<id>();
        Predictions__c pc = new Predictions__c();
        pc.Social_Post__c = sp.id;
        insert pc;
        ApiLog__c al = new ApiLog__c();
        insert al;
        ContentDocumentLinkTriggerHelper.addTagsToSocialPost(sp, tags, apiLogsList) ;
        insert contentlink;

    static void AddTagsToPostTest(){
        SocialPost sp = new SocialPost(Name= 'image');
        insert sp;
         String tags = 'test tags';
        ApiLog__c al = new ApiLog__c();
        al.SocialPost__c = sp.id;
        List<ApiLog__c> apiLogsList = new List<ApiLog__c>();
         set<id> SocialPostIds = new Set<id>();

        insert apiLogsList;
        ContentDocumentLinkTriggerHelper.addTagsToSocialPost(sp, tags, apiLogsList) ;

    static void testAccessTokenCallout() {
        // Set mock callout class 
        Test.setMock(HttpCalloutMock.class, new MockHttpResponseGenerator());
        // First request
        Http h = new Http();        
        HttpRequest req1 = new HttpRequest();
        req1.setBody('Access Token');
        HttpResponse res1 = h.send(req1);
        System.assertEquals('{"access_token":"somevalidAccessToken"}', res1.getBody());
        // Second request       
        HttpRequest req2 = new HttpRequest();
        HttpResponse res2 = h.send(req2);
        System.assertEquals('{"tagsToSend" : "12345"}', res2.getBody());
        SocialPost sp = new SocialPost(Name= 'image');
        insert sp;
        set<id> SocialPostIds = new Set<id>();
its showing me this error:-System.NullPointerException: Attempt to de-reference a null object At bold lines
Can Anyone help me with this?/
guide me?

i have a field of type Date and time of type picklist. i have created a formula field to concatinate both. below is my formula.
DATETIMEVALUE(TEXT(YEAR(Start_Date__c)) + "-" 
+ TEXT(MONTH(Start_Date__c)) + "-" 
+ TEXT(DAY(Start_Date__c)) + " " 
+ if(contains(Text(Start_Time__c),'AM'),LEFT(Text(Start_Time__c), find(":",Text(Start_Time__c))),Text(Value(LEFT(Text(Start_Time__c), find(":",Text(Start_Time__c))-1))+12)+":")
+ if(find(":",Text(Start_Time__c))==2,MID(Text(Start_Time__c),find(":",Text(Start_Time__c))+1, find(':',Text(Start_Time__c))),MID(Text(Start_Time__c), find(":",Text(Start_Time__c))+1, find(':',Text(Start_Time__c))-1)) + ":00")+(4/24)

this is working for all the times that mentioned in pivklist except 12:00AM,12:30AM & 12:00PM , 12:30PM. 

Please suggest me if i am missing something.

Thanks in advance!