• Ramesh D
  • SMARTIE
  • 1022 Points
  • Member since 2018

  • Chatter
    Feed
  • 32
    Best Answers
  • 0
    Likes Received
  • 2
    Likes Given
  • 6
    Questions
  • 171
    Replies
Hi,

I am calling teamup API from Salesforce to get events data. This is my apex code:
global class EventsTeamUp {
@future(callout=true)
    Public Static Void UpdateEvents(){
         HttpRequest req = new HttpRequest();
        HttpResponse res = new HttpResponse();
        String result;
        Http http = new Http();
        datetime dt=System.now();
     	dt=dt-(1);
		String d=dt.format('yyyy-MM-dd');
		List<Event> eventlist = new List<Event>();
        
        req.setMethod('GET' );
        req.setEndpoint('https://api.teamup.com/ks6mg6ziqj7cgg84qz/events?startDate='+d+'&endDate='+d);
        Blob headerValue = Blob.valueOf('teamup-token' + ':' + 'e1bb9869fab6320f4ff7ca23eeb48b80a9e113396b903d794d9e3fcaf857ff3f');
     String authorizationHeader = 'BASIC ' +
     EncodingUtil.base64Encode(headerValue);
     req.setHeader('Authorization', 'authorizationHeader');
        try{
        res=http.send(req);
        result=res.getBody();
Map<String, String> values = (Map<String, String>)
    JSON.deserialize(res.getBody(), Map<String, String>.class);
        System.debug(values);
        for(String key : values.keySet())
        {
           Event e= new Event(IsAllDayEvent=Boolean.valueOf(values.get('all_day')), Subject=values.get('title'), StartDateTime=DateTime.parse(values.get('start_dt')), EndDateTime=DateTime.parse(values.get('end_dt')), Location=values.get('location'), Description=values.get('notes')+'Invitees:'+values.get('who'));
            eventlist.add(e);
        }
        insert eventlist;
        }
    
    catch(Exception e)
    {
       System.debug('The following exception has occurred: ' + e.getMessage()); 
    }
}
}

I am getting 403 Forbidden error. This is the request sent from Adavnced Rest Client, where I am getting back the event details successfully.

User-added image

Any help is appreciated.
Thanks.
I have a Requirement of Grouping the data by distributor name and subgrouping by Created Date.
can anyone tell me how to achieve this.
User-added image
Hi all,
Need help on this apex class getting sql governor limit.
 
public class salesprice {

    
    public static void price(Id recordsales)
    {	
     	try
     	{
        	Account ac = [Select id,percent_increase1__c,FB_NET_ARR1__c from Account where id =:  recordsales ];
     		for( Opportunity  ap : [Select id,Type from Opportunity where AccountId  =: ac.Id ])
            {
         		if(ap.Type == 'Renewal')
            	{
                	List<OpportunityLineItem> ab = [Select id,ProductCode from opportunityLineitem where opportunityId =: ap.Id ];
                	if(ab[0].ProductCode == '002')
                    {
                		ab[0].UnitPrice = ac.percent_increase1__c * ac.FB_NET_ARR1__c;
     	   				update ab;
                    }
            	}
            }     
     }
     catch(Exception e)
     {
         System.debug(e);
     }
    }
}

Trigger to call above class:
trigger updateproduct on Account (after insert,after update) {
     
    for(Account a: Trigger.new)
    {
   			 salesprice.price(a.Id);
    }
}

Thanks in advance
I have a piece of code inside my lightning component as follows

CompA.cmp

 <lightning:card>
                <lightning:layout>
                    <lightning:layoutItem flexibility="auto" padding="around-small">
                       <div onkeyup="{!c.handleKeyUp}">
                            <lightning:input
                                             aura:id="enter-search"
                                             name="searchProvider"
                                             label=""
                                             placeholder = "Search by Name, Speciality, Procedure, Condition or Provider ID  "
                                             type="search"
                                             />
                        </div>
                        
                    </lightning:layoutItem>
                    <lightning:layoutItem flexibility="auto" padding="around-small">
                   
                         <lightning:card title="" aura:id="showhide">
                    <cCompB/>
                </lightning:card>

<aura:if  some condition

then display <c:CompC/>

<./aura:component>

CompAController.js

handleKeyUp: function (component,event,helper) {
      
        var isEnterKey = event.keyCode === 13;
        if (isEnterKey) {
            var queryTerm = component.find('enter-search').get('v.value');
           }        }

when I enter some text in above component then it should scroll down automatically to compC
The issue I am facing is it is not scrolling to compC I have to manually scroll from the side bar to compC.

Please tell me how to do this> I find it difficult to handle.

thanks
meghna N

So there is an APEX Trigger and APEX Test Class I deployed in production. 

It turned out the APEX Trigger is not working well, so I tried to removed the Trigger; however apparently there is no way I can delete a trigger from production.  Instead, I need to deactivate the trigger and push that to production.  

And here comes the problems.
- How can I meet 75% code coverage when the trigger is inactive?  it won't run, right?
- Even if I somehow manage to deactivate the trigger in Production how can I delete the test class from production which is no longer valid (since its trigger is now inacive).  It will always fail the local test

Hi all,

I have written batch class  which will be sheduled to delete reports which were created 6 months and are not used. I am not sure if this is correct or is there anything required please need suggestion for this.
Global class BatchMassDeleteReports Implements Database.batchable<sobject>{
    
     global Database.QueryLocator start(Database.BatchableContext BC){
        
     return Database.getQueryLocator([SELECT Id from Report where CreatedDate <= LAST_N_DAYS:180 AND LastModifiedDate <= LAST_N_DAYS:180]);
     }
     global  void execute(Database.BatchableContext BC,List<Report> scope){
         list<Report> delReports = (list<Report>)scope;
         if(delReports.CreatedDate <= LAST_N_DAYS:180 && delReports.LastModifiedDate <= LAST_N_DAYS:180)
         {
         delete delReports;
         }   
    }
    global void finish(Database.BatchableContext BC){
        
    }

 } 
Test CLass :-

@istest
public class bucket1controllertest{

public static testmethod void metd1(){
Bucket1__c b = new Bucket1__c();
b.Aadhar_Number__c ='jcshusd66';
b.CBIL__c ='77567';
b.PAN_Number__c='hshshbhj678';
//b.Start_Date_and_TimeStamp__c =Now();
b.Accomodation_Type__c='own' ;
b.Already_have_a_Loan__c ='No';
b.Borrower_Name__c='jkcndjd';
b.Company_Name__c = 'abc';
b.Company_Type__c = 'jsdnjd';
b.Credit_card_holder__c ='Yes';
//b.Date_of_birth__c  = '1/08/1995';
b.Eligibility_Check__c = true;
b.Email__c='testr@gmail.com';
b.Full_Residential_Address__c = 'hdyh khskfh khsd kuhsukds hkdsdb';
b.Hoapital_clinic__c ='hbdc';
b.Last_Month_Salary__c = 67557;
b.Loan_Amount_Eligible__c = 600000;
b.Loan_Amount__c = 900000;
b.Obligation_Amount__c = 1000000;
b.Phone_number__c = '678767876';
b.Scheme__c ='hjgjdgsjdh';
b.Treatment__c ='jdnd';
insert b;
}
}

Class:-

public class Bucket1controller {

public Bucket1__c buck1 = new Bucket1__c();

public Bucket1__c getbuck1(){


return buck1;
}

    public Bucket1controller(ApexPages.StandardController controller) {

    }

public pageReference Bucket1form2(){


return Page.Bucket1form2page;
}

public PageReference Saveall(){
Bucket1__c b = new Bucket1__c();
b.Aadhar_Number__c =buck1.Aadhar_Number__c;
b.CBIL__c =buck1.CBIL__c;

b.PAN_Number__c=buck1.PAN_Number__c;
b.Start_Date_and_TimeStamp__c = buck1.Start_Date_and_TimeStamp__c;
b.Accomodation_Type__c= buck1.Accomodation_Type__c;
b.Already_have_a_Loan__c =buck1.Already_have_a_Loan__c;
b.Borrower_Name__c=buck1.Borrower_Name__c;
b.Company_Name__c = buck1.Company_Name__c;
b.Company_Type__c = buck1.Company_Type__c;
b.Credit_card_holder__c = buck1.Credit_card_holder__c;
b.Date_of_birth__c  = buck1.Date_of_birth__c;

b.Eligibility_Check__c = buck1.Eligibility_Check__c;
b.Email__c=buck1.Email__c;
b.Full_Residential_Address__c = buck1.Full_Residential_Address__c;

b.Hoapital_clinic__c = buck1.Hoapital_clinic__c;

b.Last_Month_Salary__c = buck1.Last_Month_Salary__c;

b.Loan_Amount_Eligible__c = buck1.Loan_Amount_Eligible__c;
b.Loan_Amount__c = buck1.Loan_Amount__c;

b.Obligation_Amount__c = buck1.Obligation_Amount__c;
b.Phone_number__c = buck1.Phone_number__c;
b.Scheme__c =buck1.Scheme__c;
b.Treatment__c =buck1.Treatment__c;

insert b;

return Page.savedsuccessfully;
}

}
  • May 30, 2019
  • Like
  • 0
<apex:page standardController="Account">
<apex:form id="myform">
<apex:pageBlock >
<apex:pageBlockSection id="theform" columns="1">


<apex:inputField value="{!Account.Rating}">
    <apex:actionSupport event="onchange" reRender="myform" />

</apex:inputfield>

<apex:inputField id="myform" value="{!Account.phone}" rendered="{!Account.Rating == 'warm'}"  ></apex:inputField>

</apex:pageBlockSection>

</apex:pageBlock>

</apex:form>
  
</apex:page>
  • May 29, 2019
  • Like
  • 0
I'm building a Formula (Text) field to display documents when certain criteria is hit. The formula is below.

IF( 
Candidate__r.Company_Group_Type_Text__c == 'Potentials', 
IMAGE('/servlet/servlet.FileDownload?file=0151v000003E7qF', ''), 
IF( 
Candidate__r.Company_Group_Type_Text__c == 'Trusted', 
IMAGE('/servlet/servlet.FileDownload?file=0151v000003E7qZ',''), 
IF( 
Candidate__r.Company_Group_Type_Text__c == 'Associate', 
IMAGE('/servlet/servlet.FileDownload?file=0151v000003E7qK', ''), 
IF(
Candidate__r.Company_Group_Type_Text__c == 'Influencer', 
IMAGE('/servlet/servlet.FileDownload?file=0151v000003E7qU', ''),
IF(
Candidate__r.Contact_ID__c  == '0030Y00001JQUHr', 
IMAGE('/servlet/servlet.FileDownload?file=0151j000000DoLm', ''),  
IF(
Source__c == 'Vacancy Lead' &&  Source_Date__c  >= TODAY() - 7 &&  Source_Date__c  <=  TODAY(), 
IMAGE('/servlet/servlet.FileDownload?file=0151j000000Dp1y', ''),  
IF(
Source__c == 'Vacancy Lead' &&  Source_Date__c  >= TODAY() - 14 &&  Source_Date__c  <=  TODAY() - 8, 
IMAGE('/servlet/servlet.FileDownload?file=0151j000000Dp3f', ''),  
IF(
Source__c == 'Vacancy Lead' &&  Source_Date__c  >= TODAY() - 21 &&  Source_Date__c  <=  TODAY() - 15, 
IMAGE('/servlet/servlet.FileDownload?file=0151j000000Dp3G', ''),  
IF(
Source__c == 'Vacancy Lead' &&  Source_Date__c  >= TODAY() - 28 &&  Source_Date__c  <=  TODAY() - 22, 
IMAGE('/servlet/servlet.FileDownload?file=0151j000000Dp3V', ''),  
IF(
Source__c == 'Vacancy Lead' && Source_Date__c >= TODAY() - 7 &&  Source_Date__c  <=  TODAY()&& Candidate__r.Company_Group_Type_Text__c == 'Influencer' || 'Potentials' || 'Trusted' || 'Associate', 
IMAGE('/servlet/servlet.FileDownload?file=0151j000000Dp1y', ''),  
IF(
Source__c == 'Vacancy Lead' && Candidate__r.Company_Group_Type_Text__c == 'Influencer' || 'Potentials' || 'Trusted' || 'Associate' && Source_Date__c  >= TODAY() - 14 &&  Source_Date__c  <=  TODAY() - 8, 
IMAGE('/servlet/servlet.FileDownload?file=0151j000000Dp3f', ''),  
IF(
Source__c == 'Vacancy Lead' && Candidate__r.Company_Group_Type_Text__c == 'Influencer' || 'Potentials' || 'Trusted' || 'Associate' && Source_Date__c  >= TODAY() - 21 &&  Source_Date__c  <=  TODAY() - 15, 
IMAGE('/servlet/servlet.FileDownload?file=0151j000000Dp3G', ''),  
IF(
Source__c == 'Vacancy Lead' && Candidate__r.Company_Group_Type_Text__c == 'Influencer' || 'Potentials' || 'Trusted' || 'Associate' && Source_Date__c  >= TODAY() - 28 &&  Source_Date__c  <=  TODAY() - 22, 

IMAGE('/servlet/servlet.FileDownload?file=0151j000000Dp3V', ''),  
NULL 
)))))))))))))

The highlighted section i have recently added and is the issue, it doesn't seem to like the '||' but i need it to say if the source is Vacanacy Lead, if the soruce date is between the specified and if the Company Group Type Text equals Potentials or trusted or influencer or associate.

The only part it isn't liking is the Company Group Type Text equals Potentials or trusted or influencer or associate.
 
Hi all,

I am developing a console application in C# and have integrated the SalesForce SOAP API into this application, I am trying to retrieve contacts from SalesForce using a SOQL query. I have created 2 custom fields and have set values to these fields on a few test contacts, and can see these values in the developer console when i run the query

"SELECT AccountId, Id, EmailSuppressionStatus__c, SmsSuppressionStatus__c FROM Contact"

I can see the custom field values in the developer console, however, when i run the soql query in my C# application the custom fields are returning null, I have checked the security for the fields and I should be able to read/write to them, in addition, i have regenerated the Enterprise WSDL within my project but the problem still persists.

Does anybody have any idea what the issue could be?

Thank you

 
I have a lightning datatable as follows. I have given piece of code which I have done.

 <aura:attribute name="mydata" type="Object"/>
 <aura:attribute name="mycolumns" type="List"/>
  <aura:attribute name="openEOBLink" type="String" default=""/>

 <lightning:datatable
                             keyField="id"
                             data="{!v.mydata }"
                             coumns="{!v.mycolumns }"
                             hideCheckboxColumn="true"/>

Controller.js

doInit :  function(component, event, helper) {
 helper.bindDatatableColumns(component,event,helper);   
}
                         
Helper.js

  bindDatatableColumns : function(component,event,helper){ 
        
      component.set('v.mycolumns', [
            {   label: 'Version', 
                fieldName: 'Version', 
                type: 'text', 
                sortable:true,
                cellAttributes: {alignment: 'center'}
            },
            { 
                label: 'EOB/EOP',
                fieldName: 'EOBEOP',
                sortable:false,
                type: 'text',
                cellAttributes: {alignment: 'center'}    
            }

 component.set('v.mydata', [{
                     id: 'a',
                     Version:'1',
                     EOBEOP: component.get("v.openEOBLink")
                },

    component.set("v.openEOBLink",'/lightning/n/GPS_Search_EOB?c__claimId=' + component.get("v.claimId") +
                                           '&c__dateOfService=' +  component.get("v.dateofservice") + 
                                            '&c__memberId=' + component.get("v.memberId") +    
                                            '&c__memberNameforProvider=' + component.get("v.memberName") +
                                            '&c__legalOwnerName=' + component.get("v.ownerName")); 
} //Helper class ends here
   
I am able to display the datatable values and when I click on EOB link in datatable it will take me to an app Builder page by passing the parameter values.

My requirement is as follows:

a. In datatable column value I want to separate EOB and EOP
    clickable links so when I click EOB link it will navigate to EOB
    appbuilder page similarly when I click EOP link it will navigate to
    EOP app Builder  page.

    I have provided a sample code of app builder page and the
    parameters which I need to pass

 Please help me with correct code how I can achieve my requirement.

Thanks
meghna
 
public static void createCommunicatOHistory(List<Id> activityIds, ){
       
        
    }
    
    public static List<Id> createSalesforceActivities(List<Id> recordIdSet ,String message, Datetime scheduleDateTime, String status){
        List<Task> lstTask = new List<Task>();
        for(String id: recordIdSet){
            Task taskObj = new Task();
            taskObj.ActivityDate = Date.valueOf(scheduleDateTime);
            taskObj.Status = status;
            taskObj.Description = message;
            taskObj.WhoId = id;
            
            lstTask.add(taskObj); 
        }
        insert lstTask;
        List <id> activityIds = new List<Id>();
        if(lstTask.size()>0){
            for(Task t : lstTask){
                activityIds.add(t.id);
            }
        }
        return activityIds;
    }

Hi,
I want to pass the activityIds returned as a parameter to createCommunicatOHistory method. How can i do it?
  • April 23, 2019
  • Like
  • 0
First and foremost, i am a newbie with SF so pls bear with me and beg your pardon, if I dont use any adequate terms
Problem statement : Want to access files attached to Case objects using the SFDC rest api or by executing SOQL query. 

The following is what i have tried so far but no sucess.
I am using a SF dev account. A workflow has been set to read email with invoices and convert into case  with attachments. 
However, when I ran a SOQL query from the dev console,
Select Id from Attachment

I dont see any attachments info. Moreover, I dont see any object called Attachment in ObjectManager. I also see that the attachments are visible under Files  but dont see a way to use SOQL Query api to fetch those. 
So, can anybody provide any info as to how to fetch attchments referred in cases programatically in Java.

 
I have a json as follows.
[{"claimId":"M00234835","dateOfServiceBegin":"2018-12-31","legalOwnerName":"Joseph, Alice A","totalBilled":1000,"summary":"summary1","description":"descp1","dateTime":"2019-04-22T05:51:00.000Z","priority":"Low"},
{"claimId":"M00234834","dateOfServiceBegin":"2019-01-01","legalOwnerName":"Health 1st PC","totalBilled":1000,"summary":"","dateTime":"","priority":"Low"}]

I have a lightning component and in the markup I want to display the individual values of the above json.

so I am doing l like this.
<aura:attribute name="claimReworkRecords" type="Object" access="global" description="Claims Rework Data"/>

Now I am getting the entire JSON data into the above attribute I specified.

for(var i=0;i<claimsData.length;i++)
            {
                claimReworkRecords.push({
                    "claimId": claimsData[i].claimId,
                    "dateOfServiceBegin":claimsData[i].dateOfServiceBegin,
                    "legalOwnerName":claimsData[i].legalOwnerName,
                    "totalBilled":claimsData[i].totalBilled,
                    "dateTime":dateTime[i],
                    "priority":priority[i],
                    "summary":summary[i],
                    "description":description[i],
                })
            }

Now I want to display the individual values so in markup I am doing like this
 <aura:iteration items="{!v.claimReworkRecords}" var="claim" indexVar="indx">
            {!claim.claimId}
            {!claim.dateOfServiceBegin}
            
        </aura:iteration>

But its not displaying the individual values. Pleas let me know with correct code how I can achive this.

thanks
meghna
  • Setup the Email  to Salesforce:
  1. Navigate to Setup > Email > My Email to Salesforce.
  2. Enter your email id (Accenture ID) in the My Acceptable Email Addresses field.
  3. In the Email Associations section, select the Automatically assign them to related salesforce.com records radio button.
  4.  Select the Leads checkbox and then select the The record with the most activity radio button under the If duplicate records are found, associate email with: section.
  5. Select the If no matching records are found, create a task for each recipient and send it to My Unresolved Items checkbox.
  6. Save the settings and note the Email to Salesforce Address.
Hi,

I have a field called Discount... However what really happens is if a customer sees a discount field on final print page with a value of "0" , they become skeptical about a possible discount.

What I really want is if the discount field is greater than 0 or lets say just filled only then it gets displayed in the final screen, if there is no discount or value is 0. it should not get displayed in final form
I am getting error:-

Error: Jsonwrapclass Compile Error: Method does not exist or incorrect signature: void add(Jsonwrapclass.conlist) from the type List<Contact> at line 20 column 9

Controller
public with sharing class Jsonwrapclass {
public String jsonString {get;set;}
 public  Jsonwrapclass(){
 jsonString = prepareData();
 }
 private string prepareData()
{
acc a=new acc();
account acou=[select name,industry from account where id='0010K00001px8HpQAI'];
list<contact> conl=[select id,lastname from contact where accountid='0010K00001px8HpQAI'];
a.name=acou.name;
a.industry=acou.industry;
List<contact> lcllist=null;
for(contact co:conl){
conlist c=new conlist();
c.id=co.id;
c.lastname=co.lastname;
system.debug(c);
lcllist=new list<contact>();
lcllist.add(c);
}
system.debug(lcllist);

/* if(lcllist==null){
lcllist=new list<contact>();
lcllist.add(c);
}*/

//a.conlist=lcllist;
string s=system.JSON.serialize(a);
return s;
}

Public class acc{
string name {get; set;}
string industry {get; set;}
list<contact> conlist{get;set;}
}
public class conlist{
string id {get; set;}
string lastname{get; set;}

}
}
Hello friends. I am playing around with generating a nested json string to send to netsuite. It seems like there are two options: use the JSONGenerator or use JSON.serialize() and use it seralize a class that has properties that are the same as netsuite's. 

I have Generator working in the snippet below. This is my first time doing this kind of thing. So, I'm just wondering if there are any opinions on these two approaches  or maybe something I haven't considered. 
 
JSONGenerator gen = JSON.createGenerator(true);
Invoicing__c invs = [select Id, 
                           		  Name, 
                                  Invoice_Name__c, 
                                  Expected_Invoice_Date__c,
                                  Primary_Billing_Contact_Email_id__c,
                                  Project__r.Subsidiary_Usage__r.Netsuite_Subsidiary_Id__c,
                                  Project__r.Project_Consultant__r.Netsuite_Id__c,
                                  Project__r.Owner_Netsuite_Id__c,
                                  Status__c,
                                  Project__r.Netsuite_Id__c,
                                  (select Id, Quantity__c, Sales_Price__c, Product__r.Netsuite_Product_Code__c from Invoice_Line_Items__r)
                          from Invoicing__c limit 1];
system.debug(invs.Name);

gen.writeStartObject();
gen.writeStringField('recordType', 'invoice');
gen.writeStringField('isDynamic', 'false');
gen.writeFieldName('columns');
gen.writeStartObject();
gen.writeObjectField('tranid', invs.Name);
gen.writeObjectField('companyid', invs.Project__r.Netsuite_Id__c);
gen.writeObjectField('trandate', invs.Expected_Invoice_Date__c);
gen.writeEndObject();

gen.writeFieldName('lines');
gen.writeStartObject();
gen.writeStringField('sublistId', 'item');
gen.writeFieldName('lineItems');
gen.writeStartArray();
for(Invoice_Line_Item__c ili : invs.Invoice_Line_Items__r) {
	gen.writeStartObject();
	gen.writeObjectField('quantity', ili.Quantity__c);
	gen.writeObjectField('rate', ili.Sales_Price__c);
	gen.writeObjectField('accout', ili.Product__r.Netsuite_Product_Code__c);
	gen.writeEndObject();
}    
gen.writeEndArray();
gen.writeEndObject();
gen.writeEndObject();
    
system.debug(gen.getAsString());

 

Hello, I'm having troubles trying to get data from google maps api, specifically distance  matrix service.

The problem is that every time i send the request via salesforce i got a 400 error, BUT if I take the url of the endpoint from the logs and paste it in a browser the json is returned regularly:

Here is the code that I'm using: Am I missing something? Thank you in advance.

 

public String getJsonResults(
            String address1,
            String address2) {
        
        HttpRequest req = new HttpRequest();
        Http http = new Http();
        HttpRequest request = new HttpRequest();
				
                
         String url = 'https://maps.googleapis.com/maps/api/distancematrix/json'
            + '?key=......'
            + '&origins=' + address1
            + '&destinations=' + address2
            + '&mode=driving'
            + '&sensor=false'
            + '&language=en'
            + '&units=imperial';
            System.debug('url:   ' + url);
                
        request.setEndpoint(url);
        request.setMethod('GET');
        HttpResponse response = http.send(request);


that's what i get from system.debug when I check for the request:
System.HttpRequest[Endpoint=https://maps.googleapis.com/maps/api/distancematrix/json?key=......&origins=Via Celano,Avezzano&destinations=Via Roma,Aquila&mode=driving&sensor=false&language=en&units=imperial, Method=GET]
If i paste this string in a browser, it works. 

Already added the endpoint "https://maps.googleapis.com" to remote sites, what should I do? Thanks again

I am looking for an advice on batch jobs best practices.

1. We have a subscription custom object that has a lookup to contact.
2. We currently have a bach job 'nightly subscription update' that runs at 10pm to sets the status of subscription based on 'lastmodifieddate' (set status to lapsing, lapsed, and deleted),
3. There is a process builder on subscription, when changed calls flow to set the contact status (recalculates contact status based on related subscriptions).
4. there are few million subscriptions.

Now I have a 2 new requirements that
a. Delete subscriptions if today >subscription 'deletedate' and
b. Delete Contact if today > contact 's'deletedate'.

Solution that I am thinking of created 2 seperate batch classes a. 'subscription delete' and b. 'contact delete'.
And schedule/run each of this batch job without interfering one another.

i.e schedule as below
1. 'nightly subscription update' 10pm
2. 'nightly subscription Delete' 11pm
1. 'nightly contact delete' 12pm

with this approach, I am assuming the batch job will start at the exact time and finished i an hour.

Hence looking for help the better architect the solution 


 
Hope you are doing well!
Anyone have docs for enabling azure IDP for salesforce communities, wanna enable azure b2c singin/singnup for community site. Please let me know if anyone has successfully or trying to achive this.
Thanks in advance

-Ramesh
Can we write trigger when someone publish content(article page) on salesforce CMS
User-added image
User-added image
Content Management Workspace is not visible for few users in our org, What permission should be granted to view this ?
Anyone can please help??
Need to auto approve membership request for community chatter group? is there a way we can develop this?
User-added imageThanks
I need to hide the View button inside Lightning Datatable based on Team Group Name in that same row 
User-added image

If team Group name is blank then view button must be hidden and if team group name is not blank then i need to show view button
Here is my code:
columns: [ {label: "Course Title", fieldName: "CourseTitle", type: "text"}, {label: "Team Group Name", fieldName: "TeamGroupName", type: "text"}, {label: "Campus Name", fieldName: "CampusName", type: "text"}, {label: "Course", fieldName: "Course", type: "text"}, {label: "Section ID", fieldName: "SectionID", type: "text"}, {label: "Session", fieldName: "Session", type: "text"}, {label: "Course Level", fieldName: "CourseLevel", type: "text"}, {label: "Term Length", fieldName: "TermLength", type: "text"}, {type: "button", typeAttributes: { label: 'View', name: 'View', title: 'View', disabled: false, value: 'view', iconPosition: 'left' }} ]
Component:
<aura:component implements="force:appHostable" controller="Teams_Controller"> <aura:attribute type="Account[]" name="acctList"/> <aura:attribute name="mycolumns" type="List"/> <aura:handler name="init" value="{!this}" action="{!c.fetchAccounts}"/> <lightning:datatable data="{! v.acctList }" columns="{! v.mycolumns }" keyField="id" hideCheckboxColumn="false" onrowaction="{!c.viewRecord}"/>
 
I've Visualforce page on lighting community portal, i need to pass querystring to this page to get data when page loads but when i try to fetch on controller it gives me null
//Controller code
ApexPages.CurrentPage().getParameters().get('feeType')

Querystring in the url i pass
http://mysinstance/my-dashboard?feeType=xx_fee&visaID=xxx0BalG

and when i print ApexPages.CurrentPage().getParameters() i see completely different url

/apex/VP_PaymentForm?clc=0&isdtp=p1&nonce
Hi,
I don't know if this is possible. I would appreciate any help. 

The requirement is to dynamically get picklist values and loop through each to display the pick value in each row's screen flow data table with an input text field. Once the data is entered, save the picklist value and input text in another object.

screen flow data example as below
User-added image
  • April 16, 2023
  • Like
  • 0
How to Display All Records in a Lookup field of target Object while creating new record on source Object without entering any text in Search bar .   As per my Knowledge it is one of the limitation of Lightning experince. In salesforce classic we have an option of "Show All Result".
So kindly suggest me a way to achieve this without customizing the page.User-added image
Hope you are doing well!
Anyone have docs for enabling azure IDP for salesforce communities, wanna enable azure b2c singin/singnup for community site. Please let me know if anyone has successfully or trying to achive this.
Thanks in advance

-Ramesh
Can we write trigger when someone publish content(article page) on salesforce CMS
User-added image
User-added image
Content Management Workspace is not visible for few users in our org, What permission should be granted to view this ?
Anyone can please help??
We have created a Azure ad b2c tenant and registered application and given registered application id in the salesforce. When we have contacted microsoft. they are telling issue with sales force. Please help me how i can solve this issue. This is high priority for me . any help would me much appreciated.

User-added image
  • December 20, 2019
  • Like
  • 0
Hello EveryOne,

I have Doc File in Notes & Attachments.
I want to Fetch Body of doc file as a String in Apex Class.
as a body of Attachment return in Blob so how to get it as String ??
Hi,

I am calling teamup API from Salesforce to get events data. This is my apex code:
global class EventsTeamUp {
@future(callout=true)
    Public Static Void UpdateEvents(){
         HttpRequest req = new HttpRequest();
        HttpResponse res = new HttpResponse();
        String result;
        Http http = new Http();
        datetime dt=System.now();
     	dt=dt-(1);
		String d=dt.format('yyyy-MM-dd');
		List<Event> eventlist = new List<Event>();
        
        req.setMethod('GET' );
        req.setEndpoint('https://api.teamup.com/ks6mg6ziqj7cgg84qz/events?startDate='+d+'&endDate='+d);
        Blob headerValue = Blob.valueOf('teamup-token' + ':' + 'e1bb9869fab6320f4ff7ca23eeb48b80a9e113396b903d794d9e3fcaf857ff3f');
     String authorizationHeader = 'BASIC ' +
     EncodingUtil.base64Encode(headerValue);
     req.setHeader('Authorization', 'authorizationHeader');
        try{
        res=http.send(req);
        result=res.getBody();
Map<String, String> values = (Map<String, String>)
    JSON.deserialize(res.getBody(), Map<String, String>.class);
        System.debug(values);
        for(String key : values.keySet())
        {
           Event e= new Event(IsAllDayEvent=Boolean.valueOf(values.get('all_day')), Subject=values.get('title'), StartDateTime=DateTime.parse(values.get('start_dt')), EndDateTime=DateTime.parse(values.get('end_dt')), Location=values.get('location'), Description=values.get('notes')+'Invitees:'+values.get('who'));
            eventlist.add(e);
        }
        insert eventlist;
        }
    
    catch(Exception e)
    {
       System.debug('The following exception has occurred: ' + e.getMessage()); 
    }
}
}

I am getting 403 Forbidden error. This is the request sent from Adavnced Rest Client, where I am getting back the event details successfully.

User-added image

Any help is appreciated.
Thanks.
I have a Requirement of Grouping the data by distributor name and subgrouping by Created Date.
can anyone tell me how to achieve this.
User-added image
I am doing a POST call to external rest resource. The authorization is 2 step process and I need to pass the JSESSIONID in the second call which is received in first call.

With the POSTMAN, it works fine. Not sure why Apex is giving me 302 as the response status code. Can someone please help what is wrong in my code?

Body-
User-added image
Header - 
User-added image

Below is my code for Http Request -


HttpRequest req1 = new HttpRequest();
String body = 'username=' + username + '&password=' + password + '&_csrf=' + csrf_token;
req1.setEndpoint('https://onlinehearing-backend.cloudapi-dev.sivantos.com/admin/login');
req1.setMethod('POST');
req1.setBody(body);
req1.setHeader('Cookie', sessionIdString); // sessionIdString is sessionId in format -  JSESSIONID=69C4096F47BB59594D5D6C45A20A166C
//req1.setHeader('Authorization',  'Bearer '+sessionId);

Http http1 = new Http();
HTTPResponse resp = http1.send(req1);
System.debug('resp>>' + resp);
Hi,

I am showing the value of a date/time field but the format is off.
This is what I would like it to show (as show on the Page Layout):
Format from Page Layout

However this is what it looks like in my component:
Format from component

My code:
<lightning:formattedDateTime value="{!task.Task_LastModifiedDate__c}" timeZone="{!$Locale.timezone}" year="numeric" month="numeric" day="numeric" hour="2-digit" minute="2-digit" hour12="false"/>
Basically I just want to show the standard date/time format.

Thanks,
Michael
Hi All,

Am trying to group the table values in lightning component.Please help me on this to resolve this issue.

How to aggregate the bewlo field values. After aggragte I need to display a single row for each group in Lightning component.
any one can help on this?

User-added image

Thanks,
Shakila

Hi,
 

I have two fields, Shipping Address and Billing Address,

I want to copy the value of shipping address into billing address, while typing the value in shipping address, 

How can I achieve this.

There is a checkbox, which when checked, clears the value of billing address.
So when billing address is different, User can go and fill nee address

We have a Lightning Community and enabled Self Registration.
The issue is weird. It takes approx 20-25 seconds for the very first User registration of the day and all user registrations onwards take only 2.5-3 seconds. We are facing this problem on normal sandbox as well as on partial sandbox also.
Code snippet is as below:
 
public void registerUser(String newUserJson) {
	// This is the input, received from an Lightning Component
	Contact userContact = (Contact)JSON.deserialize(newUserJson, Contact.class);
	
	// This Account has Owner which has role - No issue here
	Account userAccount = [SELECT Id FROM Account WHERE Name = 'Individual' LIMIT 1];	
	
	Profile userProfile = [SELECT Id FROM Profile WHERE Name = 'ABC Community User' LIMIT 1];

	// Setup User data
	User newUser = new User();
	newUser.UserName = generateUniqeUserName(userContact.Email);
	newUser.Email = userContact.Email;
	newUser.FirstName = userContact.FirstName;
	newUser.LastName = userContact.LastName;
	newUser.ProfileId = userProfile.Id;

	// If using site to host the community the user should not hit s1 after logging in from mobile.
	String networkId = Network.getNetworkId();
	if (networkId != null && siteAsContainerEnabled(Network.getLoginUrl(networkId))) {
		newUser.UserPreferencesHideS1BrowserUI = true;
	}

	// Compute dynamic nickname for user
	String nickname = ((userContact.FirstName != null && userContact.FirstName.length() > 0) ? userContact.FirstName.substring(0, 1) : '' ) + userContact.LastName.substring(0, 1);
	nickname += String.valueOf(Crypto.getRandomInteger()).substring(1, 7);
	newUser.CommunityNickname = nickname;

	// First Create Contact	
	userContact.AccountId = userAccount.Id;
	INSERT userContact;
		
	// Create User
	newUser.ContactId = userContact.Id;
	String userId = Site.createPortalUser(newUser, userAccount.Id, password, true);
}

public static boolean siteAsContainerEnabled(String communityUrl) {
	Auth.AuthConfiguration authConfig = new Auth.AuthConfiguration(communityUrl, '');
	return authConfig.isCommunityUsingSiteAsContainer();
}
	
public static String generateUniqeUserName(String email) {        
	return email + ((isSandbox() == true) ? '.abc.sandbox' : '.abc');
}

public static Boolean isSandbox() {
	return [SELECT Id, Name, OrganizationType, NamespacePrefix, InstanceName, IsSandbox FROM Organization].IsSandbox;
}

Please advise what might be taking so long time for simple User registration.

Note: We don't have any other failure in code or complete process, its all about long execution time for only first user registration of the day.
Thanks.
controller

({
    doInit : function(component, event, helper) {
        
       var action = component.get("c.getProjectDetails");
      //action.setparm
        action.setCallback(this,function(response){
             if (response.getState() === "SUCCESS"){
                    component.set("{!v.contacts}",response.getReturnValue());
                }
            
       
            var dodge__DR_NBR__c = response.getState();
            if (dodge__DR_NBR__c === "SUCCESS") {
               
                 component.set("v.contacts", response.getReturnValue());
                    
               
                console.log(response.getReturnValue());
            }
            
            }
        );
        
    
    
        
        var action1 = component.get("c.getProjectList");
        action1.setCallback(this,function(response){
                if (response.getState() === "SUCCESS"){
                    component.set("{!v.details}",response.getReturnValue());
                }
     
            var dodge__DR_NBR__c = response.getState();
            if (dodge__DR_NBR__c === "SUCCESS") {
                component.set("v.details", response.getReturnValue());
                console.log(response.getReturnValue());
            }
            
            }
        );
 
         $A.enqueueAction(action);
         $A.enqueueAction(action1);
        
       
         

 
    }
})

component

<aura:component controller="LeadRep" implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global"  >
  <aura:attribute name="contacts" type="String" />
    <aura:attribute name="details" type="String" default="hello"/>
    
    


    
 

 
  <aura:handler name="init" value="{!this}" action="{!c.doInit}" />
    
   <!-- Use a data table from the Lightning Design System: https://www.lightningdesignsystem.com/components/data-tables/ -->
       
       
         
   
 <article class="slds-card">
  <div class="slds-card__header slds-grid">
      
      
    <header class="slds-media slds-media_center slds-has-flexi-truncate">
      <div class="slds-media__figure">
        <span class="slds-icon_container slds-icon-standard-account" title="Rep_Lead">
          <lightning:icon iconName="doctype:image" alternativeText="Doc image" />
          <span class="slds-assistive-text">Rep Lead</span>
        </span>
      </div>
      <div class="slds-media__body">
        <h2 class="slds-card__header-title">
          <a href="javascript:void(0);" class="slds-card__header-link slds-truncate" title="Rep_Lead">
            <span>Rep Lead</span>
          </a>
        </h2>
      </div>
    </header>
      
  
  </div>
  <div class="slds-card__body slds-card__body_inner">Card Body</div>
  </article>  
         
         
 <div class="slds-box slds-theme_default">        
     
 <h2>Contact Information</h2>
     
      
     <div class="slds-grid slds-gutters">
  <div class="slds-col">
      
 
 <span><ui:inputText label="Dodge Report Number"  value="{!v.contacts.dodge__DR_NBR__c}" /></span>
   
        <span><span><ui:inputText label="Project name" value="{!v.contacts.dodge__TITLE__c}"/></span></span>
<span><span><ui:inputText label="Project name" value="{!detail.dodge__PROJECT_ROLE__c}"/></span></span>
        </div>
  
</div>   

     
</div>
     
    <table class="slds-table slds-table_cell-buffer slds-table_bordered">
  <thead>
    <tr class="slds-line-height_reset">
        
        
              <th class="" scope="col">
        <div class="slds-truncate" title="dodge__TITLE__c">dodge TITLE</div>
      </th>
      <th class="" scope="col">
        <div class="slds-truncate" title="dodge__PROJECT_ROLE__c">Project Role</div>
      </th>
      <th class="" scope="col">
        <div class="slds-truncate" title="dodge__DR_NBR__c">Dodge Report Number</div>
      </th>
      <th class="" scope="col">
        <div class="slds-truncate" title="dodge__P_ADDR_LINE1__c">Address1</div>
      </th>
      <th class="" scope="col">
        <div class="slds-truncate" title="Project Opportunity">Project Opportunity</div>
      </th>
     
    </tr>
  </thead>
  <tbody>
      <aura:iteration items="{!v.details}" var="detail"> 
       <aura:iteration items="{!v.contacts}" var="contact">    
      
apex class
public class LeadRep {

    
    
@AuraEnabled
   
    Public static list<dodge__DODGE_PROJECT__c>getProjectDetails(){
        return [SELECT dodge__TITLE__c,dodge__DR_NBR__c,dodge__P_ADDR_LINE1__c FROM dodge__DODGE_PROJECT__c where dodge__DR_NBR__c='201800529072'];
    }

   /* @AuraEnabled 
  Public static list<dodge__DODGE_ROLE__c>getProjectList() {
      return [SELECT dodge__PROJECT_ROLE__c FROM dodge__DODGE_ROLE__c where dodge__DR_NBR__c='201800529072'];
  }*/
    @AuraEnabled 
   Public static list<dodge__DODGE_ROLE__c>getProjectList() {
      return [SELECT dodge__PROJECT_ROLE__c,dodge__DODGE_ACCOUNT__c,dodge__DODGE_CONTACT__r.dodge__FIRM_NAME__c FROM dodge__DODGE_ROLE__c where dodge__DR_NBR__c='201800529072']; 
   }
 /* @AuraEnabled 
  Public static list<dodge__Dodge_Project_Lead__c>getDodgeProjectLeadList() {
     return [SELECT dodge__P_ADDR_LINE1__c FROM dodge__Dodge_Project_Lead__c where dodge__DR_NBR__c='201800529072']; 
  }*/
    

    
}
      
    <tr class="slds-hint-parent">
     
      <td>
        <div class="slds-truncate" title="{!contact.dodge__TITLE__c}">{!contact.dodge__TITLE__c}</div>
      </td>
      <td>
        <div class="slds-truncate" title="{!detail.dodge__PROJECT_ROLE__c}">{!detail.dodge__PROJECT_ROLE__c}</div>
      </td>
      <td>
        <div class="slds-truncate" title="{!contact.dodge__DR_NBR__c}">{!contact.dodge__DR_NBR__c}</div>
      </td>
      <td>
        <div class="slds-truncate" title="{!contact.dodge__P_ADDR_LINE1__c}">{!contact.dodge__P_ADDR_LINE1__c}</div>
      </td>
      <td>
        <div class="slds-truncate"  title="Create"><a href="swifterfans--lf1.lightning.force.com/lightning/o/Opportunity/list?filterName=Recent">Create</a></div>
      </td>
      
    </tr>
           
    </aura:iteration>
     
    </aura:iteration>
   
  </tbody>
</table>
    
    
  
</aura:component>