• MagulanDuraipandian
  • PRO
  • 2105 Points
  • Member since 2012


  • Chatter
    Feed
  • 66
    Best Answers
  • 0
    Likes Received
  • 2
    Likes Given
  • 11
    Questions
  • 793
    Replies
Hi there,
I have created an Aura Lightning Component which is button that opens an hyperlink.
I want to get the URL from current record of "Lead" via a custom field in called "URL__c". I have tried to use "force:hasRecordId" but I am not able to get the value.
Here is my implementation of my lightning component:
<aura:component implements="lightning:availableForFlowScreens" access="global">
	<center><ui:button label="Open Opportunity" press="{!c.openActionWindow}"/></center>
</aura:component>
({
	openActionWindow : function(component, event, helper) {
        window.open("{!v.URL__c}");
	}
})
Hello All, I'm trying to create a parent component that uses wire service to grab task records and then sorts them into two maps(?) to be consumed by child components. I need them sorted by Status = Completed or Status != Completed.

I'm having trouble figuring out how to iterate over the returned records.

Any help would be greatly appreciated!

Controller
public with sharing class ATLController {
    @AuraEnabled(Cacheable=true)
    public static List<Task> getTasks(String recordId) {
        return [SELECT Id, Subject, TaskSubtype, ActivityDate FROM Task WHERE WhatId = :recordId];
    }
}
JS
import { LightningElement, api, wire } from 'lwc';

export default class AtlBase extends LightningElement {
    @api recordId;

    completedTaskList = [];
    upcomingTaskList = [];

    @wire(getTasks, {recordId:'$recordId'}) 
        tasks; 

        for(let task in tasks){
            if(task.Status === 'Completed'){
                completedTaskList.push(task);
            } else if(task.Status != 'Completed'){
                upcomingTaskList.push(task);
            }
        }
}


 

Hello All,    

I wanted to create a overlay popover using lwc and not using aura lightning overlay component. How can i do this ?

Thanks in advance !

  • March 23, 2020
  • Like
  • 0
Hi, I have an apex trigger which displays total tasks related to opportunity, but my trigger is not working even it doesn't have any errors. Can someone help me with this trigger?

//Apex Trigger

trigger OpportunityTaskCount on Task (after insert, after update, after delete, after undelete) {
    Set<Id> oppList = new Set<Id>();
    Set<Id> tskList = new Set<Id>();
    List<Opportunity> updateList = new List<Opportunity>();
    if(trigger.isInsert) {
        for(Task tsk : trigger.new) {
            if(tsk.WhatId != NULL) {
                oppList.add(tsk.Id);
                tskList.add(tsk.WhatId);
            }
        }
        system.debug('Opportunities'+oppList);
    }
    if(trigger.isDelete || trigger.isUpdate ) {
        for(Task tsk : trigger.old) {
            if(tsk.WhatId != NULL) {
                oppList.add(tsk.Id);
                tskList.add(tsk.WhatId);
            }
        }
    }
    if(trigger.isUndelete) {
        for(Task tsk : trigger.new) {
            if(tsk.WhatId != NULL) {
                tskList.add(tsk.WhatId);
            }
        }
    }
    for (Opportunity opp : [SELECT Id, Name, Total_Tasks__c ,(SELECT Id, Status FROM Tasks) 
                           FROM Opportunity 
                           WHERE Id in : oppList]) {
                               opp.Total_Tasks__c = opp.Tasks.size();
                               updateList.add(opp);
                           }
    update updateList;
}
I've been tinkering with a query as an exercise/proof of concept that would return an account, its associated contacts, opportunitires and cases, with some details of each related record.  And for the most part it works great. The part that breaks is when I try to pull in the contact name (first and alst) form the contact related to each Case -- as opposed to the contacts across the entire account.  If it comes ot it, I'll probably have ot manipulate the results in Apex anyway, so I can do the cleanup there, but I'm trying to work out if this is even possible, and so far coming up with only pat of an answer. (For the time being I'm just running these form the Qeury Editor in Developer Console.)

The part that works looks like this:
SELECT Id, Name,
 (SELECT FirstName, LastName, Title, Email, Phone FROM Contacts),
 (SELECT Name,StageName,Amount,CloseDate FROM Opportunities),
 (SELECT CaseNumber,ContactId,Subject,Priority,Status FROM Cases)
FROM Account
WHERE Name = 'Burlington Textiles Corp of America'

Adn this gives me everythign I ask for with no complaints, and I can also get any of the contact fields that are actually transcribed to the  Case record (Email, Phone, Fax, etc.).

What breaks, is when I try to get something form the Case Contact by reference like:

SELECT Id, Name,
 (SELECT FirstName, LastName, Title, Email, Phone FROM Contacts),
 (SELECT Name,StageName,Amount,CloseDate FROM Opportunities),
 (SELECT CaseNumber,ContactId,Contact.FirstName, Contact.LastName, Subject,Priority,Status FROM Cases)
FROM Account
WHERE Name = 'Burlington Textiles Corp of America'

Which basiclaly gets me everything I want, but it also gives me some extraneous information abotu how it GOT the first and last name of the contact.

"Contact":{"attributes":{"type":"Contact","url":"/services/data/v48.0/sobjects/Contact/0031U00001G0UCdQAN"},"FirstName":"Perry","LastName":"Noya"}

If I attempt to embed a second query for Contact within the subquery for Case, it just throws an error saying it doesn't understande the relationship, and am I missing the __r? (No.)

It may be that I just live with the additional text and clean it up in Apex, but I'm tryign to determine if I'm just missing something simple first.
I created a VF page, and when I "edit page" and drage the VF component to the page, I select the page name from the "Visualforce Page Name" drop down, yet when I click save, I get a pop up with this error: "Component 'Visualforce' has an invalid value for property 'Visualforce Page Name'." What would the problem be? The page is enabled for lightning, so I don't know what else could be causing this error?
I was trying to create a LWC component and keep it in lightning record page and see the details of the record. But the component is not showing the data.

Can anyone help me with this?

Below are all the details:

Apex Controller:
public with sharing class caseDetailsContollerLWC {
    @AuraEnabled(cacheable=true)
    public static list<case> caseDetails(Id recordId){
        return [select id,casenumber,status,priority,subject,description from case where Id=:recordId];
        //return c;
    }
    }

LWC JS:
import { LightningElement,api,wire } from 'lwc';
import SUBJECT from '@salesforce/schema/Case.subject';
import DESCRIPTION from '@salesforce/schema/Case.description';
import CASENUMBER from '@salesforce/schema/Case.casenumber';
import STATUS from '@salesforce/schema/Case.status';
import PRIORITY from '@salesforce/schema/Case.priority';
const fields=['subject','description','casenumber','status','priority'];
import caseDetails from  '@salesforce/apex/caseDetailsContollerLWC.caseDetails'
export default class caseDetailsLWC extends LightningElement {
@api recordId;
@wire(caseDetails,{recordId:'$recordId',fields})
caseDetails({ error, data }) {
    if (data) {
        this.data  = data;
        this.error = undefined;
    } else if (error) {
        this.error = error;
        this.data  = undefined;
    }
}
}

LWC HTML:
<!--
@File Name          : caseDetailsLWC.html
@Description        : 
@Author             : ChangeMeIn@UserSettingsUnder.SFDoc
@Group              : 
@Last Modified By   : ChangeMeIn@UserSettingsUnder.SFDoc
@Last Modified On   : 3/2/2020, 10:52:24 PM
@Modification Log   : 
Ver       Date            Author                Modification
1.0    3/2/2020   ChangeMeIn@UserSettingsUnder.SFDoc     Initial Version
-->
<template>
    <div class="slds-m-around_medium">
        <template if:true={caseDetails.data}>
            <template for:each={caseDetails.data} for:item="content">
                <p key={content.Id}>{content.Id}</p>
                <p key={content.subject}>{content.subject}</p>
                <p key={content.description}>{content.description}</p>
                <p key={content.priority}>{content.priority}</p>
                <p key={content.casenumber}>{content.casenumber}</p>
               
            </template>
        </template>
        <template if:true={caseDetails.error}>
            No data
        </template>
    </div>
    
    </template>

LWC Meta XML:
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="customSearch">
    <apiVersion>46.0</apiVersion>
    <isExposed>true</isExposed>
     <targets>
        <target>lightning__AppPage</target>
        <target>lightning__RecordPage</target>
        <target>lightning__HomePage</target>
    </targets>
</LightningComponentBundle>
 
  • March 04, 2020
  • Like
  • 0
hi,
when i am trying to deploy a am having 
Error parsing file: LWC Metadata Xml Parser: ParseError at [row,col]:[2,26]
Message: Element type "LightningComponentBundle" must be followed by either attribute specifications, ">" or "/>".LightningComponentBundle error inn my XML file.


im attaching my xml
User-added image

when if removing <targets> tag ...then the component is getting deployed.

did anybody face this issue?
pls help..
A. To guarantee at least 50% of code is covered by unit tests before it is deployed
B. To ensure every usecase of the application is covered by a test
C. To confirm every trigger is executed at leat once.
D. To confirm all classes and triggers compile successfully
A.String qryName = ‘%’ + String.escapeSingleQuotes(name) + ‘%’;
String qryString = ‘SELECT ID FROM contact WHERE name LIKE \ ' % ' + qryName + ' % \ ' ';
List<contact> queryResult =Database.query(queryString);


B. String qryName = ‘%’ + name + ‘%’;
String qryString = ‘SELECT ID FROM contact WHERE name LIKE :qryName' ;
List<contact> queryResult =Database.query(queryString);

C. String qryString = ‘SELECT ID FROM contact WHERE name LIKE \ ‘%’ + name + ‘%\ ’ ’;
List<contact> queryResult =Database.query(queryString);

D. String qryName = ‘%’ + String.enforceSecurityChecks(name) + ‘%’;
String qryString = ‘SELECT ID FROM contact WHERE name LIKE :qryName;
A. Call “Opportunity.StageName.Label”.
B. Call “Opportunity. StageName.getDescribe().getLabel()”.
C. Call “opp.StageName.getDescribe().getLabel()”.
D. Call “opp.StageName.Label”.
I have built a new App for end users to use to access HD services. I am building a new component to house large buttons that will launch flows that in turn will create new cases.

So far, so good.

When I click the buttons, the flow opens in a new tab. The user completes the steps and a case is created.

Again, all good.

I do not like the user experience with the new tab though. When they click the Finish button at the end, it just takes them back to the opening screen element and does not close the tab.

What I am looking for is an experience that is more like what i get when I launch a flow from say a contact record as a quick action. That opens the flow in a some sort of sub process like this:
User-added image

User-added image

User-added image
And the sub process then closes when the user clicks the Finish button.

Is there a way to accomplish this same effect from within this new component I have built? some HTML or other that will open the flow in this same sort of process? The best I have managed so far is the separate tab and that is just not doing it for me.

Any suggestions?
Best regards,
Steve
Hi guys,

I'm having issues calling an url from salesforce. 
Here is th code.
private final String clientId = 'xxxxxxxxx';
private final String clientSecret = 'xxxxxx';
String reqbody = 'grant_type=password&client_id='+clientId+'&client_secret='+clientSecret;
Http http = new Http();
HttpRequest request = new HttpRequest();
request.setBody(reqbody);
request.setMethod('GET');
request.setEndpoint('http://xxxx/api/xx-xxx-xxxxxxx-api/v1.0/getEmplId?firstName=xxx&lastName=xxx&middleName=xx');
HttpResponse response = http.send(request);
if (response.getStatusCode() != 201) {
  System.debug('The status code returned was not expected: ' +
       response.getStatusCode() + ' ' + response.getStatus());
} else {
   System.debug(response.getBody());
}
I'm getting the following message - response|"System.HttpResponse[Status=Service Unavailable, StatusCode=503]".
I've added the site url in salesforce. 

Please let me what I'm doing wrong?!

Appreciate your help!

Thanks,
NSK
 
Is the wire service in LWC Synchronous or Asynchronous?  Is there a way to capture data from a wire inquiry and use it in a second wire service. Can you call a wire service or is it only  called when the component is loaded? Can LWC be used in a 3rd party App with Angular or React?
Howdy all,
My company is looking for a good way to keep track of which companies are subscribed to different products, especially with little data entry. Would any of you have any suggestions, how your company handles this, anything pre-built in to salesforce we should be using, that sort of thing. It would be very nice to go to a companies record and see which services and products they are currently using. Any and all input would be greatly appreciated!
Hi Team,
Any one is having the lightning documentation is done by their own.
If have please provide.. Thanks in advance\

Thanks 
Venkat.
I just got a new PC and have loaded the Data Loader on it.  I have successfully logged in and am trying to export a file but get the following error:
!LoadWisard.errorFileCreate!extract.csv
I have created a folder for the files to export to but cannot get rid of this error?
Orgs are limited to the number of Dynamic Dashboards that can be used.

However we were curious if we could create some custom Lightning Components that could somehow copy the functionality of a Dynamic Dashboard?  This would allow us to circumvent that limit somehow.  

I know it's a long shot and would require some sort of developer know-how.
Hello Folks,

How can I get the log files of process builder. To be specific I need to log file of process builder & what it has created or inserted.
Any help is appreciated.

Thank you!!
I have a flow which calls apex action to do a callout.
I am using Workbench to call this flow to test it.
I am getting the below error message:
Your query request was running for too long.
errorCode: QUERY_TIMEOUT

I don't have any SOQL inside my Flow. If I remove the callout code, the flow is working. But, if I do callout from the Apex inside @InvocableMethod method, it is failing.

Is there any limit to avoid callout from @InvocableMethod annotation?
Is it possible to show the marker in Green color instead of red color in lightning:map tag?
How to set the Popup width while using LookupHoverDetail.getHover(). If anyone has sample code, it will be very useful.
I am looking for good materials and sample questions for Service cloud exam.
String accessToken = Auth.AuthToken.getAccessToken(authProviderId, 'Open ID connect');
        system.debug('Access Token is ' + accessToken);

here authProviderId has my Auth. Provider id.

It is returning null value.

I would like to write a trigger, when the user logins in and logs out.

 

-

Magulan

http://www.infallibletechie.com

 how to get Application name using Apex?

 

Regards,

Magulan D

How to view Answers in Site without logging in?

 

Regards,

Magulan D

How many records can be exported using export details in reports?

 

--

Magulan D

How many records can be exported using Export Details button in reports?

I want to post from VF page to Facebook.

 

Can anyone help?

 

Regards,

Magulan D


#1 - Elastic is requiring us to implement custom meta tags but the Salesforce Builder isn't allowing those tags.
#2 - Meta description tags are being loaded post-render. Is that out of the box for a Lightning community and either way, how do we expose meta description tags to Google? 
Hey guys,

So go to this component definiton page:
https://developer.salesforce.com/docs/component-library/bundle/lightning-formatted-rich-text/documentation

Then make a new component with the HTML and the JS with the simple code provided. Run it and you can a bunch of errors. Probably around Quill and inserting javascript code or something. But I assume examples like this shouldn't fail correct?

User-added image
Hi Every one,
I am trying user to navigate/ switch from community page to salesforce classic application on a button click, with out user to login again.

i created a navigation bar in community builder and provided calssic Home page link as a menu item, once i click the button it is asking the user creds to  open the classic home page, how can i achieve this woth out asking login from community page to calssic application.

thanks in advance for fast reply..
Hello,

I created a simple Apex class:
@RestResource(urlMapping='/somevalue')
global with sharing class SomeValue extends Auth.ConnectedAppPlugin {
    
    @HttpGet
    global static String doGet() {
        return '444';
    }
}
Also created a test for it:
@isTest
public class SomeValueTest {
	static testMethod void testHttpGet() {
    	String res = SomeValue.doGet();
        System.assertEquals('444', res);
    }
}

and it passed successfully - https://gyazo.com/58edea3a448a946406ba2e1c39c88b8b .
I also added it to my connected app as a Custom Connected App Handler - https://gyazo.com/b40da6eaefea584fd286ed62c2cfb147 .
I enabled all the scopes (think that isn't necessary).

When I login via oAuth using the account which I used to create the Apex class - the url 'https://myInstance.salesforce.com/services/apexrest/somevalue' gives me the correct value - '444'.
But when I login via oAuth (the same connected app) using other developer edition account - the url 'https://myAnothertherInstance.salesforce.com/services/apexrest/somevalue' gives 404 - Not found.

What else should I do to make it working for all users?

 

PS
I do this to know what should I do for my real Apex class.

Hi there,
I have created an Aura Lightning Component which is button that opens an hyperlink.
I want to get the URL from current record of "Lead" via a custom field in called "URL__c". I have tried to use "force:hasRecordId" but I am not able to get the value.
Here is my implementation of my lightning component:
<aura:component implements="lightning:availableForFlowScreens" access="global">
	<center><ui:button label="Open Opportunity" press="{!c.openActionWindow}"/></center>
</aura:component>
({
	openActionWindow : function(component, event, helper) {
        window.open("{!v.URL__c}");
	}
})
Hello, we have an apex controller method that is called by a NEW button. We are using Lightning Record Pages. The controller redirects to a URL that is supposed to display a Case page layout that is assigned to a recordtype. The recordtype is passed in the URL, but the page still displays the default page layout. Can anyone give an idea why this is happening?

reType = cse.recordTypeId;
 returnURL = new PageReference('/500/e?nooverride=1&recordtype=' + rtype);
returnURL.setRedirect(true);
return returnURL;
  • March 31, 2020
  • Like
  • 0
Hi all,

I need something like a clickable image. when I click the image in a page related record should be created.

Thanks in advance.
How to generate PDF from Lightning Web Component HTML file?
Hi All,
We are building a Lightning Web Component with HTML content. We tried using jsPDF and couple of other Javascript libraries, but they doesn't seem to be locker complaint and hence we are not able to generate.

Generating via VF page is not something we want to do.

So can you please help with any pointers/suggestions on how to generate the PDF from LWC?

Thanks in advance!

Dear all,

I am quite new with Apex and have some trouble with programming two custom fields.

Our Salesforce objects have been reprogrammed by specialized company with whom we are no longer in contact with. And with the reprogramming, Contact an Opportunity no longer have a master detail relationship (so rollups do not work!). However I would like to have 2 custom fields on contact  object: the latest won opportunituty and nex won opportunity. How could I do that? process builder? or Apex? and how? 

Thank you all for your help ! 

Fred

Hi Friends,
i am using a custom Web to Lead form, where am tring to add a value into State field of Lead object. i am trying to achieve this with two approaches  below but am unable to save it.

First Approach - 
<label class="enroll__form--desc" for="State">Estado</label>
<select class="form-control enroll__form-height enroll__form-input" id="State" name="State"  placeholder="Estado"/> 

Second Approach - 
<label class="enroll__form--desc" for="State">Estado</label>
<select class="form-control enroll__form-height enroll__form-input" id="State" name="lead.State"  placeholder="Estado"/> 

Please help me 
.
Thanks in advanced
  • March 27, 2020
  • Like
  • 0
Scenario 1: I want to display all records.of selected objects from drop down list.
Scenario 2: If I open any account after above scenario then I would like to display all the files of that Account.

For Example:
If I select Account object from Drop down list of sObjects then It would be display all records of Account  object and their associated files after clicking on any Account record.
Is that possible by Lightning Component? Please let me know the solution of above scenarios.
I have some urgent need of this requirement.

Thanks in advance...
Hello All, I'm trying to create a parent component that uses wire service to grab task records and then sorts them into two maps(?) to be consumed by child components. I need them sorted by Status = Completed or Status != Completed.

I'm having trouble figuring out how to iterate over the returned records.

Any help would be greatly appreciated!

Controller
public with sharing class ATLController {
    @AuraEnabled(Cacheable=true)
    public static List<Task> getTasks(String recordId) {
        return [SELECT Id, Subject, TaskSubtype, ActivityDate FROM Task WHERE WhatId = :recordId];
    }
}
JS
import { LightningElement, api, wire } from 'lwc';

export default class AtlBase extends LightningElement {
    @api recordId;

    completedTaskList = [];
    upcomingTaskList = [];

    @wire(getTasks, {recordId:'$recordId'}) 
        tasks; 

        for(let task in tasks){
            if(task.Status === 'Completed'){
                completedTaskList.push(task);
            } else if(task.Status != 'Completed'){
                upcomingTaskList.push(task);
            }
        }
}


 
Hi, anybody can help me why I have an error in my code at line 5
public class ContactController {

    
    Profile PROFILE = [SELECT Id, Name FROM Profile WHERE Id=:userinfo.getProfileId()];
   
    if(Profile.ID == '00e1i000000p80k') {
        u.addError('You are not allowed to create contact from this button');
    }
    Else {
        public PageReference saveNew() {
    
   		 try { 
    	    insert Contact; 
   			 } catch(System.DMLException e) {
       		  ApexPages.addMessages(e);
              return null;
   			 }   

   		 return (new ApexPages.StandardController(new Contact())).edit();        

   		}
    }
  
}

On the line: if(Profile.ID = '001i00000p80k')  I have this error
Expecting '}' but was: 'if'

 

Hello All,    

I wanted to create a overlay popover using lwc and not using aura lightning overlay component. How can i do this ?

Thanks in advance !

  • March 23, 2020
  • Like
  • 0
Hi,

I have a requiremnet I have to show the activity related to object in contact object.

Thanks.
Hi,

I have a PDF file (static content) which i would like to open in a popup window when user clicks on a link in unauthenticated community portal lighting component. 

Thank you 



 
  • March 23, 2020
  • Like
  • 0
HTML
<template>
    <lightning-record-view-form record-id={recordId} object-api-name="obj__c">
    <div>
        {recordId}
    <lightning-button  variant="success" label="Invoice" onclick={handleclick}>
    </lightning-button>
    </div>
    </lightning-record-view-form>
    
</template>

JS
import { LightningElement,api,wire,track } from 'lwc';
import main from '@salesforce/apex/orderupdate.main';

export default class Invoicebutton extends LightningElement {
    @api recordId;
    @wire(main,{abf:'$recordId'})
    orders;
    handleclick(){
        main();
    }

}
    }

}

Controller
public with sharing class orderupdate {
    @AuraEnabled(cachable=true)
public static   void main(string abf){
        list<obj__c> ent=[select id,name,(select id,name from Accounts__r) from obj__C where id  =:abf];
        system.debug(ent);
}
The  debug statement is showing a null value on click of button no value is passed.
I've managed to import the Google Tag Manager code into the <head> using the lightning community settings tab. This loads perfectly fine and I can see the 'preview' window for google tag manager.

   
<!-- Google Tag Manager -->
    <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
    new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
    j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
    'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
    })(window,document,'script','dataLayer','GTM-XXXXXXX');</script>
    <!-- End Google Tag Manager -->



However, when I try to access the 'dataLayer' or 'window.dataLayer' object in a lightning component controller, it appears as undefined. I understand this is due to the SecureWindow that has been implemented.

For example:

   
addCourseToCart : function(component, event, helper) {
      dataLayer.push({
        'event': 'addToCart',
        'ecommerce': {
          'currencyCode': 'EUR',
          'add': {                                // 'add' actionFieldObject measures.
            'products': [{                        //  adding a product to a shopping cart.
              'name': 'Triblend Android T-Shirt',
              'id': '12345',
              'price': '15.25',
              'brand': 'Google',
              'category': 'Apparel',
              'variant': 'Gray',
              'quantity': 1
             }]
          }
        }
      });
    },



Is there still no way at all I can access the dataLayer using lightning communities and components? If not, this unfortunately makes it a nightmare for my customer to track in-depth interactions on their community... I'm surprised Salesforce have overlooked this...
What is the best way integration between two clouds, Here the requirement is integrate from salesforce cloud to amazon cloud..
  • April 22, 2014
  • Like
  • 1