• kailash chandra
  • NEWBIE
  • 45 Points
  • Member since 2018
  • Sr. Software Developer
  • Webkul Software Pvt Ltd


  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 7
    Questions
  • 8
    Replies
Can someone help me out to calculate the sum of VF page by using JS. I am trying with below code but not getting result when i enter numbers.

<apex:page > 
 <script>
        function myFunction() {
          var y = document.getElementById("{!$Component.num1}").value;
          console.log(y);
          var z = document.getElementById("{!$Component.num1}").value;
          console.log(z);
          var x = +y + +z;
          console.log(x);
          document.getElementById("{!$Component.demo}").innerHTML = x;
        }
    </script>
     <apex:form id="form">
         <apex:pageBlock >
             <apex:inputText id="num1" label="Number1" onchange="myFunction()"/>
             <apex:inputText id="num2" label="Number2" onchange="myFunction()"/>
         </apex:pageBlock>
         <apex:pageBlock >
             <apex:pageBlockSection id="demo"></apex:pageBlockSection>
         </apex:pageBlock>       
     </apex:form>
</apex:page>
Hello,
I need the 100% code coverage of this code, Where I am retrieving records from custom metadata. So I need to insert metadata through test class.
Please help me.
public class GenerateAccess{
    public Map<String,String> revokeAccess(String realmId){
        Map<String,String> rtrnMap=new Map<String,String>() ;
        String errorString='';    
        List<Token__mdt> tokens=new List<Token__mdt>([Select DeveloperName,MasterLabel,Access_Token__c,Sandbox_Client_Id__c,Sandbox_Client_Secret__c,Refresh_Token_Expires_in__c,Realm_Id2__c from Token__mdt where Realm_Id2__c=:realmId Limit 1]);
        if(tokens.size()>0){
            String encodedString = EncodingUtil.base64Encode(Blob.valueOf(to[0].Sandbox_Client_Id__c+':'+tokens[0].Sandbox_Client_Secret__c));
        }
    }
}
I am unable to cover the catch block of this code.
@AuraEnabled
    public static ID getUserId() {
        try{
           return userinfo.getuserid()            
        }
        catch (Exception ex) {
            return ex.getMessage();
        }
    }
User-added image

 
I need to list all community pages in dropdown on lightning pages.
How can I get all community pages using apex ?


User-added image


Regards
------------
Kailash Chandra
 
Hi,
I need to add an button in my custom component property.
how can I add this useing <design:component>?
Is it possible?

User-added image

Regards
-----------
Kailash chandra
Hi,
I am trying to send email through email template to user but It is always replacing the user merge fields by org admin's user name instead of targetobjectID user.
Org admin : luke wright
OrgWideEmailAddress owa = [select id, DisplayName, Address from OrgWideEmailAddress limit 1];
List<Messaging.SingleEmailMessage> allmsg = new List<Messaging.SingleEmailMessage>(); 
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage(); 
mail.setTemplateID('00X0S000000iBYB'); // Template Id
mail.setSaveAsActivity(false);
mail.setTargetObjectId('0050S0000023KS9'); // UserId  Name: John Doe
mail.setOrgWideEmailAddressId(owa.id);
allmsg.add(mail); 
Messaging.sendEmail(allmsg,false);
Email template Body :
-------------------------------------------------------------------------
Dear {!User.Name} ,
Hearty Congratulations on this beautiful occasion. May your marriage bring great joy, love and passion in your life. I wish to God to bless you with a wonderful marriage and a happy life ahead.
Thanks and Regards.
{!Organization.Name}
----------------------------------------------------------------

Issue: Dear {!User.Name}  should be replace by john doe while it is replacing by luke wright and email goes to correct user i.e.   john doe  
P.S.  User's merge fields is not replacing by that record ID


Please help me
document.sObjectType throwing an error in apex class 
Variable does not exist: sObjectType 
While it is working fine in anonymous window.
Please help me
Error: SendEmail failed. First exception on row 0; first error: INVALID_ID_FIELD, WhatId is not available for sending emails to UserIds.

I want to send email through the snippet in below.
List < Messaging.SingleEmailMessage > mailList = new List < Messaging.SingleEmailMessage > ();
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
mail.setTemplateId('00XJ0000000mq21MAA');//Email Template is
mail.setTargetObjectId('005J00000076xlj');//Contact,lead or userid to be specified.
mail.setWhatId('a03J000001Dc6vPIAR');//Custom object id
mail.setSaveAsActivity(false);
mailList.add(mail);
Messaging.sendEmail(mailList);

It is throwing above exception when I pass userId inside setTargetObjectId.
mail.setTargetObjectId('005J00000076xlj');
It is working fine when I pass contactId or leadId.
Please help me to send email to UserId
Hi All,

I have a scenario to calculate the workdays excluding weekend and/or Public Holiday In Einstein Analytics. 

We need something like date = now()+workdays(5) that respect weekends and/or Public Holidays - ideally taken from the "Business Hours" setup. 

In "Business Hours": We insert Holidays for countries globally.

Please, can anyone help how they implemented or it can be implemented in dataflow computation field?

Thanks

Gayatri Sharma
Hi Team,

I have installed some packages in my org, related to those packages there are 4 or 5 triggers in Account object. I need to write a custom trigger on Account object.

Please advise can we write custom trigger, if we have triggers on same object related to packages ?

Thanks,
Lakshmi S.
Can someone help me out to calculate the sum of VF page by using JS. I am trying with below code but not getting result when i enter numbers.

<apex:page > 
 <script>
        function myFunction() {
          var y = document.getElementById("{!$Component.num1}").value;
          console.log(y);
          var z = document.getElementById("{!$Component.num1}").value;
          console.log(z);
          var x = +y + +z;
          console.log(x);
          document.getElementById("{!$Component.demo}").innerHTML = x;
        }
    </script>
     <apex:form id="form">
         <apex:pageBlock >
             <apex:inputText id="num1" label="Number1" onchange="myFunction()"/>
             <apex:inputText id="num2" label="Number2" onchange="myFunction()"/>
         </apex:pageBlock>
         <apex:pageBlock >
             <apex:pageBlockSection id="demo"></apex:pageBlockSection>
         </apex:pageBlock>       
     </apex:form>
</apex:page>
Hi,
I am trying to send email through email template to user but It is always replacing the user merge fields by org admin's user name instead of targetobjectID user.
Org admin : luke wright
OrgWideEmailAddress owa = [select id, DisplayName, Address from OrgWideEmailAddress limit 1];
List<Messaging.SingleEmailMessage> allmsg = new List<Messaging.SingleEmailMessage>(); 
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage(); 
mail.setTemplateID('00X0S000000iBYB'); // Template Id
mail.setSaveAsActivity(false);
mail.setTargetObjectId('0050S0000023KS9'); // UserId  Name: John Doe
mail.setOrgWideEmailAddressId(owa.id);
allmsg.add(mail); 
Messaging.sendEmail(allmsg,false);
Email template Body :
-------------------------------------------------------------------------
Dear {!User.Name} ,
Hearty Congratulations on this beautiful occasion. May your marriage bring great joy, love and passion in your life. I wish to God to bless you with a wonderful marriage and a happy life ahead.
Thanks and Regards.
{!Organization.Name}
----------------------------------------------------------------

Issue: Dear {!User.Name}  should be replace by john doe while it is replacing by luke wright and email goes to correct user i.e.   john doe  
P.S.  User's merge fields is not replacing by that record ID


Please help me
Hi Every one  :  
I need to get the data from google fit app to salesforce , can any one help me
Error: SendEmail failed. First exception on row 0; first error: INVALID_ID_FIELD, WhatId is not available for sending emails to UserIds.

I want to send email through the snippet in below.
List < Messaging.SingleEmailMessage > mailList = new List < Messaging.SingleEmailMessage > ();
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
mail.setTemplateId('00XJ0000000mq21MAA');//Email Template is
mail.setTargetObjectId('005J00000076xlj');//Contact,lead or userid to be specified.
mail.setWhatId('a03J000001Dc6vPIAR');//Custom object id
mail.setSaveAsActivity(false);
mailList.add(mail);
Messaging.sendEmail(mailList);

It is throwing above exception when I pass userId inside setTargetObjectId.
mail.setTargetObjectId('005J00000076xlj');
It is working fine when I pass contactId or leadId.
Please help me to send email to UserId
I am trying to fetching my force.com site domain I have created. Gone through lot of internet contents but find no where a solution to fetch the complete Domain/Default site url. Possible is to query urlPathPrefix and salesforce.com domain, but not the complete force.com domain I have created.

for example: ***-developer-edition.ap2.force.com
                   ***-developer-edition.na3.force.com
                   ***-developer-edition.XYZ.force.com

could be fetched properly!
Seems to me that the following achomplish the same thing:

List<Account> aa = [SELECT Id, Name FROM Account WHERE Name = 'Acme'];

List<Account> aa = databse.query('SELECT Id, Name FROM Account WHERE Name = 'Acme'');

What are the advantages of using one over the other?
Hi All,

I have a scenario to calculate the workdays excluding weekend and/or Public Holiday In Einstein Analytics. 

We need something like date = now()+workdays(5) that respect weekends and/or Public Holidays - ideally taken from the "Business Hours" setup. 

In "Business Hours": We insert Holidays for countries globally.

Please, can anyone help how they implemented or it can be implemented in dataflow computation field?

Thanks

Gayatri Sharma