• Arshad Shaikh
  • NEWBIE
  • 25 Points
  • Member since 2015

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 3
    Questions
  • 0
    Replies
Actually I want to perform the task in which if i select vale = this month from the pick list field Named " Status" and when i select date from the field named "Approval Date" then the month & year which is formula filed should print the same month and year and if select (next month) then month & year populated to +1 month and year +1 when onth is december... like same if i select (Nect to next month) the month & year field populated to +2 month .... below is the code which tried... it works well for conditon( THIS MONTH and NEXT MONTH) but i am facing problem in NEXT TO NEXT MONTH in the month of october november and december... plz help
IF(ISPICKVAL( Status__c ,"This Month"),
 CASE( MONTH( Approval_Date__c ) ,
1, "January"&" "&TEXT(YEAR( Approval_Date__c )), 
2, "February"&" "&TEXT(YEAR( Approval_Date__c )),
3, "March"&" "&TEXT(YEAR( Approval_Date__c )),
4, "April"&" "&TEXT(YEAR( Approval_Date__c )),
5, "May"&" "&TEXT(YEAR( Approval_Date__c )),
6, "June"&" "&TEXT(YEAR( Approval_Date__c )),
7, "July"&" "&TEXT(YEAR( Approval_Date__c )),
8, "August"&" "&TEXT(YEAR( Approval_Date__c )),
9, "September"&" "&TEXT(YEAR( Approval_Date__c )),
10, "October"&" "&TEXT(YEAR( Approval_Date__c )),
11, "November"&" "&TEXT(YEAR( Approval_Date__c )),
12, "December"&" "&TEXT(YEAR( Approval_Date__c )),"none"),

IF(ISPICKVAL( Status__c ,"Next Month"),
 CASE( MONTH( Approval_Date__c )+1,
1, "January"&" "&TEXT(YEAR( Approval_Date__c )), 
2, "February"&" "&TEXT(YEAR( Approval_Date__c )),
3, "March"&" "&TEXT(YEAR( Approval_Date__c )),
4, "April"&" "&TEXT(YEAR( Approval_Date__c )),
5, "May"&" "&TEXT(YEAR( Approval_Date__c )),
6, "June"&" "&TEXT(YEAR( Approval_Date__c )),
7, "July"&" "&TEXT(YEAR( Approval_Date__c )),
8, "August"&" "&TEXT(YEAR( Approval_Date__c )),
9, "September"&" "&TEXT(YEAR( Approval_Date__c )),
10, "October"&" "&TEXT(YEAR( Approval_Date__c )),
11, "November"&" "&TEXT(YEAR( Approval_Date__c )),
12, "December","January"&" "&TEXT(YEAR( Approval_Date__c )+1)) ,

IF(ISPICKVAL( Status__c ,"Next to Next Month"),
 CASE( MONTH( Approval_Date__c )+2,
1, "January"&" "&TEXT(YEAR( Approval_Date__c )), 
2, "February"&" "&TEXT(YEAR( Approval_Date__c )),
3, "March"&" "&TEXT(YEAR( Approval_Date__c )),
4, "April"&" "&TEXT(YEAR( Approval_Date__c )),
5, "May"&" "&TEXT(YEAR( Approval_Date__c )),
6, "June"&" "&TEXT(YEAR( Approval_Date__c )),
7, "July"&" "&TEXT(YEAR( Approval_Date__c )),
8, "August"&" "&TEXT(YEAR( Approval_Date__c )),
9, "September"&" "&TEXT(YEAR( Approval_Date__c )),
10, "October"&" "&TEXT(YEAR( Approval_Date__c )),
11, "November"&" "&TEXT(YEAR( Approval_Date__c )+1)+
CASE( MONTH( Approval_Date__c ),
12,"jan","feb"&" "&TEXT(YEAR( Approval_Date__c )+1))) ,null)))

 Error: Incorrect number of parameters for function 'CASE()'. Expected 22, received 23
This Rest api Java code authenticate to insert lead is working in my dev org But when I try to do the same in production it throws error 400 Can anybody sort it out.
           static final String USERNAME     = "arshadsdeveloper@gmail.com.dev";
           static final String PASSWORD     = "************************";
           static final String LOGINURL     = "https://login.salesforce.com";
           static final String GRANTSERVICE = "/services/oauth2/token?grant_type=password";
           static final String CLIENTID     = "************************";
           static final String CLIENTSECRET = "************************";
           private static String REST_ENDPOINT = "/services/data";
           private static String API_VERSION = "/v35.0";
           private static String baseUri;
           private static Header oauthHeader;
           private static Header prettyPrintHeader = new BasicHeader("X-PrettyPrint", "1");
           private static String leadId ;
           private static String leadFirstName;
           private static String leadLastName;
           private static String leadCompany;

   public static void main(String[] args) {

       HttpClient httpclient = HttpClientBuilder.create().build();

       // Assemble the login request URL
       String loginURL = LOGINURL +
                         GRANTSERVICE +
                         "&client_id=" + CLIENTID +
                         "&client_secret=" + CLIENTSECRET +
                         "&username=" + USERNAME +
                         "&password=" + PASSWORD;

       // Login requests must be POSTs
       HttpPost httpPost = new HttpPost(loginURL);
       HttpResponse response = null;

       try {
           // Execute the login POST request
           response = httpclient.execute(httpPost);
       } catch (ClientProtocolException cpException) {
           cpException.printStackTrace();
       } catch (IOException ioException) {
           ioException.printStackTrace();
       }

       // verify response is HTTP OK
       final int statusCode = response.getStatusLine().getStatusCode();
       if (statusCode != HttpStatus.SC_OK) {
           System.out.println("Error authenticating to Force.com: "+statusCode);
           // Error is in EntityUtils.toString(response.getEntity())
           return;
       }
Any help Appreciated.
 
Is it possible to enable global search for installed apps custom object?
if yes, how?
if u enter some value in field automatically other field gets populated with same copy.
Actually I want to perform the task in which if i select vale = this month from the pick list field Named " Status" and when i select date from the field named "Approval Date" then the month & year which is formula filed should print the same month and year and if select (next month) then month & year populated to +1 month and year +1 when onth is december... like same if i select (Nect to next month) the month & year field populated to +2 month .... below is the code which tried... it works well for conditon( THIS MONTH and NEXT MONTH) but i am facing problem in NEXT TO NEXT MONTH in the month of october november and december... plz help
IF(ISPICKVAL( Status__c ,"This Month"),
 CASE( MONTH( Approval_Date__c ) ,
1, "January"&" "&TEXT(YEAR( Approval_Date__c )), 
2, "February"&" "&TEXT(YEAR( Approval_Date__c )),
3, "March"&" "&TEXT(YEAR( Approval_Date__c )),
4, "April"&" "&TEXT(YEAR( Approval_Date__c )),
5, "May"&" "&TEXT(YEAR( Approval_Date__c )),
6, "June"&" "&TEXT(YEAR( Approval_Date__c )),
7, "July"&" "&TEXT(YEAR( Approval_Date__c )),
8, "August"&" "&TEXT(YEAR( Approval_Date__c )),
9, "September"&" "&TEXT(YEAR( Approval_Date__c )),
10, "October"&" "&TEXT(YEAR( Approval_Date__c )),
11, "November"&" "&TEXT(YEAR( Approval_Date__c )),
12, "December"&" "&TEXT(YEAR( Approval_Date__c )),"none"),

IF(ISPICKVAL( Status__c ,"Next Month"),
 CASE( MONTH( Approval_Date__c )+1,
1, "January"&" "&TEXT(YEAR( Approval_Date__c )), 
2, "February"&" "&TEXT(YEAR( Approval_Date__c )),
3, "March"&" "&TEXT(YEAR( Approval_Date__c )),
4, "April"&" "&TEXT(YEAR( Approval_Date__c )),
5, "May"&" "&TEXT(YEAR( Approval_Date__c )),
6, "June"&" "&TEXT(YEAR( Approval_Date__c )),
7, "July"&" "&TEXT(YEAR( Approval_Date__c )),
8, "August"&" "&TEXT(YEAR( Approval_Date__c )),
9, "September"&" "&TEXT(YEAR( Approval_Date__c )),
10, "October"&" "&TEXT(YEAR( Approval_Date__c )),
11, "November"&" "&TEXT(YEAR( Approval_Date__c )),
12, "December","January"&" "&TEXT(YEAR( Approval_Date__c )+1)) ,

IF(ISPICKVAL( Status__c ,"Next to Next Month"),
 CASE( MONTH( Approval_Date__c )+2,
1, "January"&" "&TEXT(YEAR( Approval_Date__c )), 
2, "February"&" "&TEXT(YEAR( Approval_Date__c )),
3, "March"&" "&TEXT(YEAR( Approval_Date__c )),
4, "April"&" "&TEXT(YEAR( Approval_Date__c )),
5, "May"&" "&TEXT(YEAR( Approval_Date__c )),
6, "June"&" "&TEXT(YEAR( Approval_Date__c )),
7, "July"&" "&TEXT(YEAR( Approval_Date__c )),
8, "August"&" "&TEXT(YEAR( Approval_Date__c )),
9, "September"&" "&TEXT(YEAR( Approval_Date__c )),
10, "October"&" "&TEXT(YEAR( Approval_Date__c )),
11, "November"&" "&TEXT(YEAR( Approval_Date__c )+1)+
CASE( MONTH( Approval_Date__c ),
12,"jan","feb"&" "&TEXT(YEAR( Approval_Date__c )+1))) ,null)))

 Error: Incorrect number of parameters for function 'CASE()'. Expected 22, received 23

When someone takes the time/effort to repspond to your question, you should take the time/effort to either mark the question as "Solved", or post a Follow-Up with addtional information.  

 

That way people with a similar question can find the Solution without having to re-post the same question again and again. And the people who reply to your post know that the issue has been resolved and they can stop working on it.