• Shri Raj
  • NEWBIE
  • 359 Points
  • Member since 2014

  • Chatter
    Feed
  • 6
    Best Answers
  • 3
    Likes Received
  • 5
    Likes Given
  • 32
    Questions
  • 167
    Replies
I have a field Next order date in contract
Written a batch class to creaet automatically order if the contract is Activated. When the Contract status is made activated at that time the Next order Date will display the immediate wednesday which is handled by flow.

I need to do an setup that when Order status will be Order Dispatched then the Next Order Date should display Order Start Date + 30 days or Order Start Date + 30 days  (immediate wednesday).

Is it possible by flow If yes then how, if no then how we can achieve this.

Thanks
In flow, I would like to get a records from an object and check from an array(or an alternative) if such match exist then for those that does not exist, I need to create that records with predetermined values. So here is my sequence:
1. Fetch records for object A with filter user and year
2. from the result with perhaps an array? (January~December - as text) determine which value have no match.
3. From the list of non existing record, iterate on array with missing Month and create those records with default values.
 
I dont know how to implement or create the flow for Item 2 & 3.
Any experts help is greatly appreciated. Thank you in advance.
Hi All,

Here is my business requirement and I never worked on webservices. 

1. We have specif objects and fields to consume by Oracle.
2. Oracle will consume the webservice and then should be able to  updated few fields in SFDC.

My Assumptions:
Simply generate WSDL and provide them to consume the webservice?
or Do we have to write any classes for each object to expose the data?

Please help me, how I have to achieve this.

regards,
Ajay

  • August 05, 2014
  • Like
  • 0
Hi

Is it possible to filter child records to only the one which is added recently (based on created date).. i have a requirement to get the rullup summary for only the recently added child object field value.

i know we can do via apex. just wanted to check if there is any option with config

thanks
Hello guys,i would like to know.How many connect Apps i can have in one Salesforce organization?
Hi,
I was wondering which method is closer to best practice:


List<CampaignMember> members = [Select Id, Status From CampaignMember Where Status='Registered'];
Set<CampaignMember> memSets = new Set<CampaignMember> (members);

OR 

List<CampaignMember> members = [Select Id, Status From CampaignMember Where Status='Registered'];
Set<CampaignMember> memSets = new Set<CampaignMember> ();

memSets.addAll(members)

Hi All, 

Would it be possible to have an Validation Check in place or some kind of an pop-up asking "Are You Sure" before deploying code into Server? 
Right Click on an eclipse Project --> Force.com-->Deploy to Server

Before  Deploying to server, Do we have any option in Eclipse which we can enable to precheck. I have accidentally Hit on "Deploy to Server" rather than "Refresh from Server".  

Hello,

Is there anyway out in Salesforce where we can export data in .TSV / Tab Separated Values? Can you kindly suggest some good tools from the market?

Thanks,
Shri

Hi, 

 

Can someone refer me any links which would describe about the Integration from Salesoforce --> External System using OAuth Mechanism. Please make sure the first call goes from Salesforce. Not the other way around. 

Thanks
-Shri

Can anyone share an example considering Account as an example. 

Thanks
Shri

Hello All.

 Here is the challenge which i need to implement and looking for a solution approach. 

I need to implement a custom VF Page Search Functionality inside Salesforce. The Data is inside Elastic Search which is a open source Search & Analytic engine. The Elastic Search is inside our Company's network. I have the API to access using JSON & I'm able to do it using a REST based tool. 

Now, Since Salesforce is outside our Company's network i need to authenticate using Ping Identity & then access Elastic Search API. 

I'm really not sure about how this authentication works since the first call will be from Salesforce everytime. Can someone please help. I'm unsure if this will be using SSL or OAuth etc.

Thanks, 

Shri.

Hello, 

I would like to know if there is an email notification by default which would notifies the Users when the owner of that a particular record is assigned to them? 
I see a default check box which can also be set false. But i want to keep it active. Any profile permissions? 

Thanks, 

Shri

Hello All,

I know we can upload a CSV into Salesforce using various different ways. I'm conducting a POC in my company to upload a CSV file into Salesforce using a JAVA program. Can someone please guide or provide any reference links? 

Thanks, 
Shri

There are two record Types. RT1 and RT2. And a Status picklist field based on the recordtype. 

One a VF Page, If a user only has access to RT1 then he/she is able to see only picklist values which are displayed for RT1. 
One a VF Page, If a user only has access to RT2 then he/she is able to see only picklist values which are displayed for RT2.

If i add a permission set for a Users and give access to both the RecortyTypes RT1 & RT2, On the Visualforce Page its displaying all the picklist values and not by the Recordtype of that record. 

Please guide
Shri
I'm trying to access an external System which is inside my office network. Using the POST method I will try to access the data from that system. For Eg : If i pass the zipcode, I can get the city Name. 

What all are the things i need to consider before making this call to that system apart from the EndPoint. 

Thanks
Hello, 

Can someone explain what exactly is Authentication and how does it work in Salesforce for REST & SOAP based integrations. Please mention in simple terms. 

Thanks
I'm trying to access a inhouse EndPoint in my company from Salesforce.com through HTTP POST Method. How does the Authentication work on the Salesforce side? Before accessing the End Point do i need setup anything else on the Salesforce side?  
Hello All,

I will try to frame my question in short.

End Goal : REST API Integration from Salesforce to a InHouse Lead Management System(LMS2)

SUCCESS Through Chrome APP
1.  All i need to do is retrieve values from LMS2. When i tried to use the Chrome APP 'Advanced Rest Client' and have passed the appropriate URL and Content in XML/TEST format in the form of POST methoed I was able to retrieve the values from LMS2 database.
For EG : If i pass 92126 then i was able to get 'SAN DIEGO' which is correct.

Here is the link (https://chrome.google.com/webstore/detail/advanced-rest-client/hgmloofddffdnphfgcellkdfbfbjeloo?hl=en-US)for Advanced REST Client.


PROBLEM from Salesforce :

2) When i created this REST class in SAlesforce and tried invoking the End Point then its throwing this error.

System.HttpResponse[Status=Service Unavailable, StatusCode=503]

public with sharing class LmsRestApiIntegration {

//LmsRestApiIntegration.invokeRestAPI()
@future(callout = true)
public static void invokeRestAPI(){
String URL = 'http://pasquote-bfapp.tent.trt.ccc.pri/QuickQuoteWebSvc/QQWebSvc.asmx';
String xmlContent = '';
xmlContent = '<?xml version="1.0" encoding="utf-8"?>';
xmlContent = xmlContent + '<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">';
xmlContent = xmlContent + '<soap:Body>';
xmlContent = xmlContent + '<GetCityListFromZip xmlns="http://www.ccc.com/irv/quickquote/auto/2006/10/01">';
xmlContent = xmlContent + '<zipcode>92126</zipcode></GetCityListFromZip>';
xmlContent = xmlContent + '</GetCityListFromZip>';
xmlContent = xmlContent + ' </soap:Body>';
xmlContent = xmlContent + '</soap:Envelope>';
Http h = new Http();
HttpRequest req = new HttpRequest();
req.setBody(xmlContent);
req.setHeader('content-type','text/xml');
req.setHeader('content-length', '0');
req.setEndpoint(URL);
req.setHeader('SoapAction', 'http://www.ccc.com//irv/quickquote/auto/2006/10/01/GetCityListFromZip');
req.setMethod('POST');
String response = '' ;
HttpResponse res = h.send(req);
response = res.getBody();

System.debug('Response :'+response);

}
}

Please guide.

Thank You
Shri
Hello All,

I will try to frame my question in short.

End Goal : REST API Integration from Salesforce to a InHouse Lead Management System(LMS2)

SUCCESS Through Chrome APP
1.  All i need to do is retrieve values from LMS2. When i tried to use the Chrome APP 'Advanced Rest Client' and have passed the appropriate URL and Content in XML/TEST format in the form of POST methoed I was able to retrieve the values from LMS2 database.
For EG : If i pass 92126 then i was able to get 'SAN DIEGO' which is correct. 

Here is the link (https://chrome.google.com/webstore/detail/advanced-rest-client/hgmloofddffdnphfgcellkdfbfbjeloo?hl=en-US)for Advanced REST Client.


PROBLEM from Salesforce :

2) When i created this REST class in SAlesforce and tried invoking the End Point then its throwing this error. 

System.HttpResponse[Status=Service Unavailable, StatusCode=503]

public with sharing class LmsRestApiIntegration {

//LmsRestApiIntegration.invokeRestAPI()
@future(callout = true)
public static void invokeRestAPI(){
String URL = 'http://pasquote-bfapp.tent.trt.csaa.pri/QuickQuoteWebSvc/QQWebSvc.asmx';
String xmlContent = '';
xmlContent = '<?xml version="1.0" encoding="utf-8"?>';
xmlContent = xmlContent + '<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">';
xmlContent = xmlContent + '<soap:Body>';
xmlContent = xmlContent + '<GetCityListFromZip xmlns="http://www.csaa.com/irv/quickquote/auto/2006/10/01">';
xmlContent = xmlContent + '<zipcode>92126</zipcode></GetCityListFromZip>';
xmlContent = xmlContent + '</GetCityListFromZip>';
xmlContent = xmlContent + ' </soap:Body>';
xmlContent = xmlContent + '</soap:Envelope>';
Http h = new Http();
HttpRequest req = new HttpRequest();
req.setBody(xmlContent);
req.setHeader('content-type','text/xml');
req.setHeader('content-length', '0');
req.setEndpoint(URL);
req.setHeader('SoapAction', 'http://www.csaa.com//irv/quickquote/auto/2006/10/01/GetCityListFromZip');
req.setMethod('POST');
String response = '' ;
HttpResponse res = h.send(req);
response = res.getBody();

System.debug('Response :'+response);

}
}

Please guide.

Thank You
Shri
Just like we generate a PDF File using Apex/VF, Can we render Data in an XML format from a Page or anywhere else? And also, Can we Zip the attachment? The reason is, Thats how we are supposed to email the attachment to a particular address. Therefore,

1. Render data in an XML Attachment
2. Zip the attachment
3. Email the attachment. (I know we can do this)

Please guide

Thanks
Shri
Just like we generate a File using Apex, Can we render Data in an XML format? And also, Can we Zip the attachment? The reason is, Thats would we are supposed email the attachment to a Particular address. Therefore, 

1. Render data in an XML Attachment
2. Zip the attachment
3. Email the attachment. (I know we can do this) 

Thanks
Shri

Hello, 

Is there any ways where i can Partially inactivate an Inline Edit. Here is the scenario. 

Bascially i have a custom Related List which is a VF Page which supports an Inline Edit . I Also have a 'Mass Edit' button on the related list which opens up a 'Mass Edit' PageBlockSection. Whenever the Mass Edit button is clicked then i would like to inactivate the InlineEdit. Orelse keep it active. 

Thanks,
Shri


 

Hello, 

I have been trying to parse an WSDL into Salesforce and im receiving the following error. Please help.

Unable to find schema for element; {http://www.w3.org/2001/XMLSchema}schema

Hello, 



I was trying to Parse an XML into our Salesforce Dev org and I was getting this error. Kindly suggest what could be the problem. 

Unable to find schema for element; {http://www.w3.org/2001/XMLSchema}schema

Thanks,
Shri

Hello ,

We are planning to have a integration from Salesforce to an External System. Salesforce --> Lead Management System. Here I'm not sure if this will be only SOAP or REST could also be possible.

Before i start working on this, I would like to Integrate both Salesforce DEV and Salesforce UAT. I have Parsed the WSDL from UAT into DEV where 3 of Apex classes are created. From here onwards I'm not sure how can i take it forward. Like, Passing the Credentials and inserting/updating data from Dev to UAT.

Kindly suggest.
Shri

Hello, 


I have been getting this error. Since im using this free appliation for the first time online, It doest provide a free informatica support. Did anyof you face the same problem? What could be the problem? 
Since im testing the app, My task is light weight. Im planning to insert 2 Account records from one Sandbox instance to another. 

[FATAL] GetServerTimestamp failed. User [UserName]. Fault code [3]. Reason [SOAP Error : [Tag Error : MisMatch]. Please Contact Informatica Customer support.].
 

Can anyone share an example considering Account as an example. 

Thanks
Shri
Hello All,

I will try to frame my question in short.

End Goal : REST API Integration from Salesforce to a InHouse Lead Management System(LMS2)

SUCCESS Through Chrome APP
1.  All i need to do is retrieve values from LMS2. When i tried to use the Chrome APP 'Advanced Rest Client' and have passed the appropriate URL and Content in XML/TEST format in the form of POST methoed I was able to retrieve the values from LMS2 database.
For EG : If i pass 92126 then i was able to get 'SAN DIEGO' which is correct.

Here is the link (https://chrome.google.com/webstore/detail/advanced-rest-client/hgmloofddffdnphfgcellkdfbfbjeloo?hl=en-US)for Advanced REST Client.


PROBLEM from Salesforce :

2) When i created this REST class in SAlesforce and tried invoking the End Point then its throwing this error.

System.HttpResponse[Status=Service Unavailable, StatusCode=503]

public with sharing class LmsRestApiIntegration {

//LmsRestApiIntegration.invokeRestAPI()
@future(callout = true)
public static void invokeRestAPI(){
String URL = 'http://pasquote-bfapp.tent.trt.ccc.pri/QuickQuoteWebSvc/QQWebSvc.asmx';
String xmlContent = '';
xmlContent = '<?xml version="1.0" encoding="utf-8"?>';
xmlContent = xmlContent + '<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">';
xmlContent = xmlContent + '<soap:Body>';
xmlContent = xmlContent + '<GetCityListFromZip xmlns="http://www.ccc.com/irv/quickquote/auto/2006/10/01">';
xmlContent = xmlContent + '<zipcode>92126</zipcode></GetCityListFromZip>';
xmlContent = xmlContent + '</GetCityListFromZip>';
xmlContent = xmlContent + ' </soap:Body>';
xmlContent = xmlContent + '</soap:Envelope>';
Http h = new Http();
HttpRequest req = new HttpRequest();
req.setBody(xmlContent);
req.setHeader('content-type','text/xml');
req.setHeader('content-length', '0');
req.setEndpoint(URL);
req.setHeader('SoapAction', 'http://www.ccc.com//irv/quickquote/auto/2006/10/01/GetCityListFromZip');
req.setMethod('POST');
String response = '' ;
HttpResponse res = h.send(req);
response = res.getBody();

System.debug('Response :'+response);

}
}

Please guide.

Thank You
Shri

Hello, 

I have implemented Custom Sorting on a VF page using Comparable Interface. If there are 10 records in a Page and few of the fields on the records are NULL then the List.Sort method is not functioning properly when there are NULL and NOT NULL fields included. Please suggest. 
 

Thanks

trigger preventAccDel on Account (before delete) {
    List<Id> accountIds=new List<Id>();
    Integer count=0;
    for(Account acc:Trigger.New){
        accountIds.add(acc.Id);
    }
    for(Account a:[SELECT Id, Name, (SELECT Id, AccountId FROM Contacts) FROM Account where Id IN :accountIds]){
        for(Contact con:a.Contacts){
            count=count+1;
        }
        if(count>=2){
            a.addError('This Account is associated with 2 or more Contact records. Hence cannot be deleted');
        }
        count=0;
    }
}
ERROR:-16:20:52:632 USER_DEBUG [67]|DEBUG|[{"message":"Unexpected parameter encountered during deserialization: Amount__c at [line:1, column:15]","errorCode":"JSON_PARSER_ERROR"}]

Code:-
public class paymentfromsalesforce {
   
    
    public  static  string apiclientid;
    public  static  string apiclientsecrete;
    public  static  string username;
    public  static  string  password;
    
    public static void getAuthCreds()
    {
        salesforcefromsalesforce__c clientid = salesforcefromsalesforce__c.getInstance('Client ID');
        salesforcefromsalesforce__c clientsecreate = salesforcefromsalesforce__c.getInstance('client secret');
        salesforcefromsalesforce__c clientusername = salesforcefromsalesforce__c.getInstance('username');
        salesforcefromsalesforce__c clientpassword = salesforcefromsalesforce__c.getInstance('password');
        
        apiclientid = clientid.value__c;
        apiclientsecrete =clientsecreate.value__c;
        username  =  clientusername.value__c;
        PASSWORD  = clientpassword.value__c;
    }
   public class deserializeResponse
    {
        public String id {set;get;}
        public String access_token {set;get;}
        public string typeofpayment {set;get;}
        public integer payamount {set;get;}
        public string paymethod {set;get;}
    }
    public String ReturnAccessToken (paymentfromsalesforce acount)
    {
        // method used authoentication details in the system. 
        getAuthCreds();
        
        String reqbody = 'grant_type=password'+'&client_id='+apiclientid+'&client_secret='+apiclientsecrete+'&username='+username+'&password='+PASSWORD;
        Http h = new Http();
        HttpRequest req = new HttpRequest();
        req.setBody(reqbody);
        req.setMethod('POST');
        req.setEndpoint('https://vignesh9666-dev-ed.my.salesforce.com/services/oauth2/token');
        HttpResponse res = h.send(req);
        system.debug('The access token for the ' + res.getBody());
        deserializeResponse resp1 = (deserializeResponse)JSON.deserialize(res.getbody(),deserializeResponse.class);
        system.debug('The access token for the ' + resp1.access_token);
        return resp1.access_token;
    }

 @AuraEnabled 
 public static deserializeResponse createpayment(String ptype, integer pamount, String pstatus)
 {
  paymentfromsalesforce acount = new paymentfromsalesforce();
  String accessToken = acount.ReturnAccessToken (acount);
 
  if(accessToken != null)
  {
   
      HttpRequest req1=new HttpRequest();
            req1.setEndpoint('https://vignesh9666-dev-ed.my.salesforce.com/services/apexrest/mypaymentgateway/');
            req1.setMethod('POST');
           req1.setHeader('Content-Type','application/json');
           req1.setHeader('Accept','application/json');
          req1.setHeader('Authorization','Bearer '+accessToken);
            req1.setBody( '{"Amount__c":"' +pamount+ '"}');
            Http http1=new Http();
            HttpResponse res1=new HttpResponse();
            res1=http1.send(req1);        
            System.debug(res1.getStatusCode());
            System.debug(res1.getBody()); 
      
      deserializeResponse resp2 = (deserializeResponse)JSON.deserialize(res1.getbody(),deserializeResponse.class);
      
      system.debug('The record id is ' + resp2.id);
  }
     return resp2;
 }
   
}

webservices code from another org:-

@RestResource(urlMapping='/mypaymentgateway/*')

Global class newpaymentgatewayrcord {
     @HttpPost
    global static id paymentrecords(string ptype, integer pamount, string pstatus)
    {
        Payment_Gateway__c pay = new Payment_Gateway__c();
         
        pay.TYPE__c=ptype;
            pay.Amount__c=pamount;
            pay.Status__c=pstatus;
        
            insert pay;
        
        return pay.id;
    }

}


 
A multi-picklist field is already setup with some values. This field is referred in LWC as lightning-input-field which supports multi-picklist fields. Hence no controller or other custom component is used to retrieve the picklist values. But after adding some values to this same multi-plickist field and making them available at record type level for editing, the values are not getting displayed on the custom component page. Can someone assist?
  • January 27, 2023
  • Like
  • 0
HI,

I have enabled State and Country picklist in my Org and the scan identidied a number of Apex classes that needs code fixes.

I have an apex classs that was querying user object and it was querying state and country fields. As a result of the scan this class was picked up in the result and as a fix I changed ths state and country to say stateCode and countryCode hoping that this would take this class out of the scan results list.

But even after this change this class is still showing up in the scan results. 

Is it ok to ignore this?. Please comment or let me know if you need further information

Original code
user = [SELECT id, email, username, usertype, communitynickname, timezonesidkey, languagelocalekey, firstname, lastname, phone, title, street, city, PostalCode, state, country, localesidkey, mobilephone, extension, fax, contact.email FROM User WHERE id = :UserInfo.getUserId()];

Changed Code
user = [SELECT id, email, username, usertype, communitynickname, timezonesidkey, languagelocalekey, firstname, lastname, phone, title, street, city, PostalCode, stateCode, countryCode, localesidkey, mobilephone, extension, fax, contact.email FROM User WHERE id = :UserInfo.getUserId()];
HI,

I have enabled State and Country picklist in my Org and the scan identidied a number of Apex classes that needs code fixes.

I have an apex classs that was querying user object and it was querying state and country fields. As a result of the scan this class was picked up in the result and as a fix I changed ths state and country to say stateCode and countryCode hoping that this would take this class out of the scan results list.

But even after this change this class is still showing up in the scan results. 

Is it ok to ignore this?. Please comment or let me know if you need further information

Original code
user = [SELECT id, email, username, usertype, communitynickname, timezonesidkey, languagelocalekey, firstname, lastname, phone, title, street, city, PostalCode, state, country, localesidkey, mobilephone, extension, fax, contact.email FROM User WHERE id = :UserInfo.getUserId()];

Changed Code
user = [SELECT id, email, username, usertype, communitynickname, timezonesidkey, languagelocalekey, firstname, lastname, phone, title, street, city, PostalCode, stateCode, countryCode, localesidkey, mobilephone, extension, fax, contact.email FROM User WHERE id = :UserInfo.getUserId()];
 
I have a field Next order date in contract
Written a batch class to creaet automatically order if the contract is Activated. When the Contract status is made activated at that time the Next order Date will display the immediate wednesday which is handled by flow.

I need to do an setup that when Order status will be Order Dispatched then the Next Order Date should display Order Start Date + 30 days or Order Start Date + 30 days  (immediate wednesday).

Is it possible by flow If yes then how, if no then how we can achieve this.

Thanks
I get the error  "DataSource.Error: exceeded 100000 distinct who/what's Details:     [List]" in Power BI while having the role as admin... Can someone help me out? 
In flow, I would like to get a records from an object and check from an array(or an alternative) if such match exist then for those that does not exist, I need to create that records with predetermined values. So here is my sequence:
1. Fetch records for object A with filter user and year
2. from the result with perhaps an array? (January~December - as text) determine which value have no match.
3. From the list of non existing record, iterate on array with missing Month and create those records with default values.
 
I dont know how to implement or create the flow for Item 2 & 3.
Any experts help is greatly appreciated. Thank you in advance.
I am trying to export non-printable report into .XLSX format and send it to external users via email. Exporting to CSV works fine, but when I try to export the same with .XSLX format, I am getting the attachment either in corrupt state or an unformatted state.

Is it possible to export a report in .xslx format?

Below is my code snippet, I am trying out with different combinations of report URL and content type, but none of them worked. Please help if there is any way forword for this?
String reportId = '00O1700000*****';
String instanceName = System.URL.getSalesforceBaseUrl().toExternalForm();
string url=instanceName+'/'+reportId+'?excel=1'; // Not working
//string url=instanceName+'/'+reportId+'?export&xf=xls'; // Not working
//string url=instanceName+'/'+reportId+'?csv=1&isdtp=p1'; //Not working
ApexPages.PageReference report = new ApexPages.PageReference(url);
Messaging.SingleEmailMessage email =new Messaging.SingleEmailMessage();
List<Messaging.EmailFileAttachment> csvAttcList = new List<Messaging.EmailFileAttachment>();
Messaging.EmailFileAttachment csvAttc = new Messaging.EmailFileAttachment();
String mailBody = 'Please find the attachment for daily case report.';
csvAttc.setFileName('Daily Case Report.xlsx');
csvAttc.setBody(report.getContent());
csvAttc.setContentType('text/vnd.openxmlformats'); //Not working
//csvAttc.setContentType('text/csvs'); //Not working
//csvAttc.setContentType('application/vnd.ms-excel'); //Not working
csvAttcList.add(csvAttc);
email.setSubject('Daily Case Report on '+System.now());
List<String> toAddress = new List<String>();
toAddress.add('email@gmail.com');
email.setToAddresses( toAddress );
email.setPlainTextBody(mailBody);
email.setFileAttachments(csvAttcList);
Messaging.sendEmail(new Messaging.SingleEmailMessage[] {email});

 
the Question Is  regarding Leave  Record ,  to calculate no of days based on start date  and End Date  and Also There is one Picklist field as a Leave Type and the picklist Values are 1) First half  2)  Second Half and 3) Full day 
 if user Select The First half With start date  and Date As same Then in no of days it should populate  0.5(no_of_Days__c is a formula Field)

 This formula Working fine for without picklist values we need to only do for FIRST HALF and SECOND HALF  Picklist Values .
  IF(End_Date__c == Start_Date__c, 1, (End_Date__c - Start_Date__c )+ 1)


 
A lot of our dates and activities relate to three terms in the school year.
The start and end dates of the terms vary from year to year.
In reports I need to be able to identify an activity as falling within one of the five following timeframes:

before last term
last term
this term
next term
after next term

Each of these time frames will have a start date and end date
Where can I store these dates so that they can be accessed in formulae in custom fields?

Ideally I want just one copy that all custom fields and reports can reference so that when I update them at the start of each term every report automatically uses the new values.
I have created calendar events and assigned them based on departments. I also set up permission groups so that people are only allowed to create events for themselves or their departments.I want everyone in the organization to see have access to the other calendars to view but not edit.  I want to set it up so that a person is able to edit their department's events but only view other calendars.



Here is a formula that I have tried
NOT(OR(ISNEW()
IF(OwnerId='Development' && RecordTypeId='Development' &&  $Permission.Calendar_Editing_Development=true, true, false) ||
IF( OwnerId = 'Organizational' && RecordTypeId = 'Organizational' &&  $Permission.Calendar_Editing_Organizational =true, true, false) ||
IF(OwnerId = 'Program Inventory' && RecordTypeId = 'Program_Inventory'  &&  $Permission.Calendar_Editing_Inventory =true, true, false) ||
IF(OwnerId = 'Financial' && RecordTypeId = 'Financial'  &&  $Permission.Calendar_Editing_Financial =true, true, false) ||
IF(OwnerId = 'Evaluation' && RecordTypeId = 'Evaluation' &&  $Permission.Calendar_Editing_Evaluation =true, true, false) ||
IF( OwnerId = 'Board' && RecordTypeId = 'Board' &&  $Permission.Calendar_Editing_Board =true, true, false), true,false))


 
Hi everyone
whenever any new offer is created into system for any product. Send
Email alert to all customers with the offer and product details
Hello, 
i have a requirement about my List with pagination that uses a wrapper class. I would like to standart order the records by date descending. I tried some code on the internet but i do get errors or it doesnt work. Could you please show me how to impleent it?
 
<aura:component controller="ApexActivityWrapper" implements="force:appHostable,flexipage:availableForAllPageTypes,force:hasRecordId" access="global">

       
    	
        <aura:attribute name="accountList" type="Object" />
        <aura:attribute name="PaginationList" type="Object"/>
    <aura:attribute name="perPageSize" type="Integer" default="10"/>
        <aura:attribute name="totalRecords" type="Integer"/>
    <aura:attribute name="totalPages" type="Integer" default="0"/>
        <aura:attribute name="startValue" type="Integer" />
        <aura:attribute name="endValue" type="Integer"/>
     <aura:attribute name="columns" type="List"/>
     <aura:attribute name="sortedBy" type="String"/>
    <aura:attribute name="sortedDirection" type="String"/>
    <aura:attribute name="isLastPage" type="Boolean"/>
    <aura:attribute name="currentPageNumber" type="Integer" default="1"/>
   

     <aura:handler name="init" action="{!c.doInit}" value="{!this}"/>


    <!-- Ergebnisse + Pagination-->
    
    <div class="slds-grid slds-grid_vertical">
        
        <aura:if isTrue="{!not(empty(v.PaginationList))}">
                 <lightning:datatable data="{!v.PaginationList}" 
                                         columns="{!v.columns}" 
                                         keyField="Id"
                                      	 onsort="{!c.updateSorting}"
                                         sortedBy="{!v.sortedBy}"
                                      	 sortedDirection="{!v.sortedDirection}" 
                                         hideCheckboxColumn="true"
                                      	/>
                <aura:set attribute="else">
                    <div Style="text-align : center"> Keine Aktivitäten
                    </div>
                </aura:set>
            </aura:if>
        
      <lightning:buttongroup>
          
          <lightning:button onclick="{!c.previous}" disabled="{!v.startValue == 0}" label="Previous" iconName='utility:back'/>
          <lightning:button onclick="{!c.next}" disabled="{!v.isLastPage}"  label="Next" iconName='utility:forward'/>
    	
    </lightning:buttongroup>   
      
        
    
</div>
</aura:component>
 
({
    doInit : function(component, event, helper) { 
        
          
        var action = component.get("c.ApexActivityWrapper");
            var recordId = component.get('v.recordId');
        	
            action.setParams({ recordId : recordId });
        action.setCallback(this, function(response) {
            var state = response.getState();
            component.set('v.accountList', response.getReturnValue());
            
            console.log(component.get('v.accountList'));
            //total number of accounts recieved-----------------------------------------
            var lengthVar = component.get("v.accountList").length;
            console.log('length///'+lengthVar);
            component.set("v.totalRecords",lengthVar); 
            //---------------------------------------------------------------------------
            //number of records in each page---------------------------------------------
            var perPage = component.get("v.perPageSize");
            //---------------------------------------------------------------------------
            var values=[];
            console.log('perPage///'+perPage);
            //If total number of records are more than 5 or equals 5-----------------------
            if(lengthVar >= perPage){
                for(var i=0;i<perPage;i++){
                    values.push(response.getReturnValue()[i]);
                }
            }//--------------------------------------------------------------------------
            else{//If total number of records are lesser than 5--------------------------
                for(var i=0;i<lengthVar;i++){
                    values.push(response.getReturnValue()[i]);
                }
            }//--------------------------------------------------------------------------
            console.log('values///'+values);
            component.set("v.PaginationList",values);
            component.set("v.startValue",0);
            //if there are only 5 records or lesser than that in total-------------------
            if(lengthVar <= (component.get("v.startValue")+perPage)){
                component.set("v.isLastPage",true);
            }
            component.set("v.endValue",component.get("v.startValue")+perPage-1); 
        });
        $A.enqueueAction(action);
        component.set('v.columns', 
                      [ {label: 'Status', 			fieldName: '', 															initialWidth: 50, 		cellAttributes: {iconName: {fieldName: 'StatusPicOut' } } },
            //{label: "Datum", 			fieldName: 'DatumOut', 		sortable: true,		type: "date", 			initialWidth: 80, 		typeAttributes:	{month: "2-digit", day: "2-digit", hour: "2-digit", minute: "2-digit", hour12: true } },           
            {label: "Datum", 			fieldName: 'DatumOut', 		sortable: true,		type: "date", 			initialWidth: 110, 		typeAttributes:	{day: '2-digit', month: '2-digit', year: '2-digit', hour: '2-digit', minute: '2-digit', hour12: false } },   
            {label: 'Art', 				fieldName: '', 															initialWidth: 60, 		cellAttributes: {iconName: {fieldName: 'ArtPicOut' } } },
            {label: 'Thema', 			fieldName: 'ThemaIdOut',	sortable: true, 	type: 'url', 			initialWidth: 500,		typeAttributes: {label: {fieldName: 'ThemaOut'}, tooltip: {fieldName: 'TooltipOut'}, target: '_self'} },
            {label: 'Kontakt', 			fieldName: 'KontaktIdOut',	sortable: true, 	type: 'url',									typeAttributes: {label: {fieldName: 'KontaktOut' }, target: '_self'} },
            {label: 'Bezug zu', 		fieldName: 'BezugIdOut',	sortable: true, 	type: 'url',									typeAttributes: {label: {fieldName: 'BezugOut' }, target: '_self'} },
            {label: 'Zugewiesen zu', 	fieldName: 'ZugewiesenOut',	sortable: true,		type: 'text' }, 
                      ]);
    },
                       
        updateSorting: function (cmp, event, helper) {
        var fieldName = event.getParam('fieldName');
        var sortDirection = event.getParam('sortDirection');
        cmp.set("v.sortedBy", fieldName);
        cmp.set("v.sortedDirection", sortDirection);
        helper.sortData(cmp, fieldName, sortDirection);
    },
                       
      
                       
   
    previous : function(component, event, helper){
        component.set("v.isLastPage",false);
        var sObjectList = component.get("v.accountList");
        console.log('sObjectList///',sObjectList);
        var startValue=component.get("v.startValue");
        var endValue=component.get("v.endValue");
        var perPage = component.get("v.perPageSize");
        console.log('startValue///',startValue);
        console.log('endValue///',endValue);
        var totalRecords = component.get("v.totalRecords");
        var values=[];
        for(var i=startValue-perPage;i<startValue;i++){
            console.log('i'+i);
            values.push(sObjectList[i]);
        }
        component.set("v.PaginationList",values);
        component.set("v.startValue",startValue-perPage);
        component.set("v.endValue",startValue-1);
        console.log('start value////'+component.get("v.startValue"));
        console.log('end value////'+component.get("v.endValue"));
    },
    next : function(component, event, helper){
        var sObjectList = component.get("v.accountList");
        console.log('sObjectList///',sObjectList);
        var startValue=component.get("v.startValue");
        var endValue=component.get("v.endValue");
        var perPage = component.get("v.perPageSize");
        console.log('startValue///',startValue);
        console.log('endValue///',endValue);
        var totalRecords = component.get("v.totalRecords");
        var values=[];
        //for eg-------------------------------------------------------------------------
        // this is page 2 and there are 10 records
        // endValue is 4
        //if total no. of records == 4+5+1 (i.e. 10)
        //Or if total no. of records > 10, then evaluate this part----------------------
        if(totalRecords >= endValue+perPage+1){
            for(var i=endValue+1;i<endValue+perPage+1;i++){
                values.push(sObjectList[i]);
            }
            if(totalRecords == endValue+perPage+1){//if total records == 4+5+1-----------
                component.set("v.isLastPage",true);
            }
        }//------------------------------------------------------------------------------
        else{//if total number of records are lesser than 4+5+1(10) i.e. 8
            for(var i=endValue+1;i<totalRecords;i++){
                values.push(sObjectList[i]);
            }
            component.set("v.isLastPage",true);
        }//------------------------------------------------------------------------------
        component.set("v.PaginationList",values);
        component.set("v.startValue",endValue+1);
        component.set("v.endValue",endValue+perPage);
        console.log('start value////'+component.get("v.startValue"));
        console.log('end value////'+component.get("v.endValue"));
    },
    
})
 
({
	    sortData: function (cmp, fieldName, sortDirection) {
        var fname = fieldName;
        var data = cmp.get("v.accountList");
        var reverse = sortDirection !== 'asc';
        data.sort(this.sortBy(fieldName, reverse))
        cmp.set("v.accountList", data);
    },
    sortBy: function (field, reverse) {
        var key = function(x) {return x[field]};
        reverse = !reverse ? 1 : -1;
        return function (a, b) {
            return a = key(a), b = key(b), reverse * ((a > b) - (b > a));
        }
    },
})

I am trying to write a trigger on the License object (sfLma__License__c) in my License Management org.. the purpose of this trigger to make a callout (in a future context) to my service to notify it of any new licenses or updates..
This is my trigger as of now
 
trigger MyLicenseTrigger on sfLma__License__c (after insert, after update) {

    for(sfLma__License__c newLicense: Trigger.newMap.values()) {
        LmoCalloutHelper.reportLicense(newLicense);
    }
}



Now if I update any editable field of this license from the UI (for eg. the Lead field) the trigger fires.. all good.


But if the managed package which is linked to the LMO is installed or uninstalled, the trigger does NOT fire.
On digging a bit, I see that on install/uninstall, the License Status is changed. But License Status is a formula field which obviously doesnt fire triggers.


But the formula field is just a $recordType.Name, so basically it seems any install/uninstall updates the Record Type of a license record.
So on install/uninstall of a package, if the Record Type is updated, why does my trigger not fire?

Hi, anyone can help me how to call ApprovarId variable from JavaScript to Apex controller to replace value = :ActorId in query?
export default class ToApproved extends LightningElement {
    ApprovarId= Id;
    availableItems;
    error;
    columns = columns;

    @wire (toApproved)
    wiredAccount({error,data}){
        if(data){
            let tempRecs = [];
            data.forEach((record)=>{
                let tempRec = Object.assign({},record);

                //Name & target object id
                var objDes = JSON.stringify(tempRec.ProcessInstance.TargetObject);
                var finalObject = JSON.parse(objDes);
                tempRec.Object = '/'+tempRec.ProcessInstance.TargetObjectId;
                tempRec.recordName = finalObject.Name;

                //Name & created/submitted user id
                var createduser = JSON.stringify(tempRec.CreatedBy);
                var finalData = JSON.parse(createduser);
                tempRec.CreatedBy = '/'+tempRec.CreatedById;
                tempRec.createdByName = finalData.Name;

                //Name and approverid
                var approvar = JSON.stringify(tempRec.Actor);
                var finalApprovar = JSON.parse(approvar);
                tempRec.ApprovedBy = '/'+finalApprovar.name;
                tempRec.ApprovarName = tempRec.Actor.Name;

                tempRecs.push(tempRec);
            });
            this.availableItems = tempRecs;
            this.error = undefined;

        }else if(error){
            this.error = error;
            this.availableItems = undefined;
        }

    }

}
 
public with sharing class toApproved {
    @AuraEnabled(cacheable=true)
    public static list<ProcessInstanceWorkitem> getItemApprove(id ActorId){
        return[select ProcessInstance.TargetObject.name, CreatedDate, CreatedBy.name, ActorId, Actor.name from ProcessInstanceWorkitem
        where ActorId = :ActorId
        order by CreatedDate limit 100];
    }
}

Thank You
 
  • December 30, 2022
  • Like
  • 0
i have a table with 3 column in visualforce page there is one input value and others are output value. When input value is changes, input value and second column value must be multiplied and the third column must show the result for per row. in table i'm using <apex:repeat> and <tr>, <td> tags so how can i do this? thanks.
hi,

I'm trying to translate the following Google Sheet formula into in custom field formula on a Contact record.
 
=JOIN("", ARRAYFORMULA(MID(DEC2HEX(A2), LEN(DEC2HEX(A2)) - ROW(INDIRECT("1:"&LEN(DEC2HEX(A4)))) + 1, 1)))&CHAR(MOD(A2, 17) + 65)
Where A2 would be a custom field reference.

The first step is to translate the value in A2 to hexadecimal, the second step is to reverse the string. The third step is to calculate modulo 17 (the remainder when the number is divided by 17).This number will always be a number from 0–16. Map that number onto the letters A–Q, where 0=A, 1=B, 2=C, etc.  Finally, concatenate each of those pieces together.

Many thanks for any help here
 
  • October 14, 2022
  • Like
  • 0
I found this out the very hard way and I would like to share my findings to either warn others, or find out if I've done something wrong somehow.  Sobjects cannot be handed lists of objects via addAll (even though they can be added objects one at a time through add, and OTHER methods that have sObject lists as parameters can accept object lists).

I'll show by example:
Account a = new Account();
sObject s
LIST<sObject> sOjbList = new LIST<sObject>();
sOjbList.add(s);
sOjbList.add(a);
That works perfectly fine, as you'd expect.
sObject s1;
sObject s2;
LIST<sObject> sList = new LIST<sObject>{s1, s2};
LIST<sObject> sOjbList = new LIST<sObject>();
sOjbList.addAll(sList);
Also works fine.

This, however, will fail.
LIST<Account> aList = new LIST<Account>{new Account(), new Account()};
LIST<sObject> sOjbList = new LIST<sObject>();
sOjbList.addAll(aList);
It gives the errors:
Incompatible argument type LIST for All method on LIST
OR
Incompatible argument type LIST<Account> for All method on LIST<SObject>
(Based on if you're using the Developer Console or something else, like MavensMate)

But don't fret, there's a solution (albeit a silly one)
private LIST<sObject> objToSobj(sObject[] objList)
{
	return objList;
}
That's right, pass your objList through this (and it will let you without problem) and all works fine.

Thoughts?
I'm experiencing a strange error with Salesforce's Inline Editing in a custom visualforce page. I have a sObject with a date field called Start_Date__c, and I have inline editing set up in the VisualForce like this:
<apex:page standardController="Product_Assignment__c"
    tabStyle="Product_Assignment__c"
    extensions="TestInlineEditControllerExt">

<apex:form id="productForm">
    <apex:pageBlock >
        <apex:pageMessages />
        <apex:pageBlockTable value="{!productAssignments}" var="productAssignment">
            <apex:column headerClass="h1">
                <apex:facet name="header">Start Date</apex:facet>
                <apex:outputField value="{!productAssignment.Start_Date__c}">
                    <apex:inlineEditSupport changedStyleClass="dirtyField" event="ondblclick" showOnEdit="saveChanges" />
                </apex:outputField>
            </apex:column>
        </apex:pageBlockTable>
    </apex:pageBlock>
    <apex:commandButton id="saveChanges" reRender="productForm" action="{!quicksave}" value="Save Changes" styleClass="saveChangesButton" />
</apex:form>
</apex:page>
The custom controller is (this is not my exact code, but it's enough to replicate the issue):
public with sharing class TestInlineEditControllerExt {
    public List<Product_Assignment__c> productAssignments { get; set; }

    public TestInlineEditControllerExt(ApexPages.StandardController stdController) {
        stdController.addFields(new List<String> { 'Start_Date__c' });
        productAssignments = new List<Product_Assignment__c> {
            (Product_Assignment__c)stdController.getRecord()
        };
    }
}
This works well in normal use cases. If I edit the field an input a deliberately incorrect value (like 'abcdef'), and press save, I receive the expected error: Start Date: Invalid Date and Time.

After this, if I attempt to click the revert button and save again, I receive a cryptic error message: Start Date: Value cannot exceed 0 characters.

I've tried following this pattern on a standard detail page, but this issue only seems to happen on my custom visualforce page. I've also tried using a custom action (instead of "quicksave") on my controller, but have the same issue (error message, controller is never called). We do not have any validation rules in place for this field.

Does anybody know why this error is happening and how I can fix this issue? It seems to only happen when I have an inline editing component inside of an apex:pageBlockTable or apex:repeat element.

Today we’re excited to announce the new Salesforce Developers Discussion Forums. We’ve listened to your feedback on how we can improve the forums.  With Chatter Answers, built on the Salesforce1 Platform, we were able to implement an entirely new experience, integrated with the rest of the Salesforce Developers site.  By the way, it’s also mobile-friendly.

We’ve migrated all the existing data, including user accounts. You can use the same Salesforce account you’ve always used to login right away.  You’ll also have a great new user profile page that will highlight your community activity.  Kudos have been replaced by “liking” a post instead and you’ll now be able to filter solved vs unsolved posts.

This is, of course, only the beginning  and because it’s built on the Salesforce1 Platform, we’re going to be able to bring you more features faster than ever before.  Be sure to share any feedback, ideas, or questions you have on this forum post.

Hats off to our development team who has been working tirelessly over the past few months to bring this new experience to our community. And thanks to each of you for helping to build one of the most vibrant and collaborative developer communities ever.
 

As many of you have discovered, our developer community is awesome. The wealth of knowledge here is phenomenal. This is an all volunteer community and people who take the time to help and post answers do so totally on their own initiative. With that said when someone provides the right answer to your question please take the time to mark their answer as the accepted solution. Also give them a kudos if they've really gone the extra mile to help out. Show some love ;)

I recently downloaded APEX Data Loader version 27.0.1. My colleague has a batch job that does a bulk upload of records to our salesforce account. I tried running the script on my computer and kept getting an error. I narrowed down the culprit to be the output of the command line when running encrypt.bat. 

 

When running the command line prompt "ecrypt.bat -g seed_text_here", the script is expecting the output to be just the key that should be saved to key.txt. This is consistent with the online video tutorial located here: http://www.salesforce.com/_app/video/data_loader/help/data_loader_cli.jsp

 

However, when I run "ecrypt.bat -g seed_text_here" on my computer, I get the following output: 

2013-04-24 15:06:21,050 INFO [main] security.EncryptionUtil main (EncryptionUtil.java:304) - encrypted_password_key_here

 

It appears to be an issue with setting the logging level. Any ideas on how to change this? 

 

Thanks.

  • April 24, 2013
  • Like
  • 1