• Swamy P R N
  • NEWBIE
  • 130 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 10
    Likes Received
  • 0
    Likes Given
  • 85
    Questions
  • 89
    Replies
Hello Folks,

I'm having one profile which is assigned already to a user ABC. Now this ABC user can create custom object records from the Web but he is not supposed to create same custom object records from the mobile.

for this i can disable create permission in the profile, but it will effect in web application as well. So how can i achieve this type of functionality?

Please advice me. Much Thanks in advance!!
Hello Everyone,

In my system there are 2 laksh records, in that 5000 records are deleted by user1. Now i want to undele only those 5000 records which are deleted by user1. How can i build the query for that. Also is it possible to un-delete the records by record deleted date. 

Thanks Much.
Hello Everyone,

We are getting continuously lot many emails, it says " Critical Update [Goals Update 1 of 2] was auto-activated (Organization Name) ".

My Client don't want to receive all these emails, he want to stop it. I tried email notifications to stop it setup->Customize->UserInterface->Enable salesforce Notification Banner(De-selected)--> Save. Still we are getting emails, how can i stop these Crititcal Update email notifications.

Please suggest me the path to disable any of the options, 
Thanks in advance!!
Hello Everyone,

Am not able to see Customer Community User Licesne in my sandbox(Enterprise Edition). Is there any option to enable this license or Are we have to pay for this seperately to salesforce for this license enable.

Please update me ASAP.
Hello Every one,

When i click on a button in visualforce page, it has to capture the screenshot of the page and it has to send an email to some user. How can i achieve this?? I tried in different ways but strucked in some protions. Will you share your idea or any solution for this.

Thanks in advance !!
Hello Everyone,

We all know what are the best practices for the Development and Admin. I prepared a Best Practices doc with all of the points for Development. Just like that i was trying to prepare a doc for Admin, but not able to put all points together. So can anyone post the links which has all points for Admin and Configuration

Thanks in advance !!!
Hello Folks,

I was facing an issue with my loading  of visualforce page. I have executed the javascript, from the javascript iam executing action method. After executing that action method, again my page is reloading but i just want to stop after execution of action method.

In the end of my action method the below code is executing correctly::
if(prdctsWithQuantity.size()>0){
              currentStep='2';  
 }

VF Page:
<script type="text/javascript">
        function showRelatedProducts(slctrcrd){
             var eterm=document.getElementById('{!$Component.frm:pb0:pblksctn:pbsitm:pfmly}').value;
              if(eterm=='')
              {
                  alert('You have to Select Product Family');
              }
              else{
                     callprdcts();
              }
    }
</script>
  <apex:actionFunction action="{!showSelectedProductFamilyRecords}" name="callprdcts" reRender="frm"/>

Actually it is showing the second step page, but again coming back to first step page. How to stop after the above logic execution..

Suggest me, Thanks in advance !!
Hello Team,

Iam able to see schedule refresh option for the dashboard but am not able to see "users" in the drop-down for sending email to particular user. Even iam not able to see this option for Admin Users. So am i need to give any permission to profile?? Please suggest me

Thanks in advance!!
User-added image
Hello Everyone,

While doing callout getting the error :: 
System.CalloutException: You have uncommitted work pending. Please commit or rollback before calling out .

Actually i am sending request to 3rd party system based on the response iam upserting records in salesforce.
When i was doing with 1 record, it is working fine. But when i tried with bulkified manner getting the above error.

So while research i got an idea that i need to seperate the transactions for both the Callout's and DML's.
Is there any function or method that callout has been done, with that i can seperate both the transactions for DML's in salesforce and Callouts

How can i avoid this particular error??  Please suggest me !!!
Hello Everyone, While doing call-outs facing an issue..when i call for few records, its working perfectly but when i call for batches its giving an error:: Uncommitted work pending. IS there a way that we can mass delete the existing records in salesforce in the sense mass delete the existing requisition records

Apex Methods:

public static Boolean bulkify = false;
     public static Map<id, Recruiting_Activities__c> requisitionRecMap ;
      @future(callout=true)
    public static void processAllOpenRequisition(){
        bulkify  = true;
          //Id recssid = ApexPages.currentPage().getParameters().get('id');

        u = [SELECT Username_Broadbean__c,Password_Broadbean__c From USER WHERE id =:UserInfo.getUserId()];
        HttpRequest req = new HttpRequest();
        req.setMethod('POST');
        req.setEndpoint('https://api.adcourier.com/hybrid/hybrid.cgi');
        req.setHeader('Content-Type', 'text/xml');
        requisitionRecMap = new Map<id, Recruiting_Activities__c>([SELECT  Time_now__c,Time_From__c,Recruiter__c, Id FROM Recruiting_Activities__c WHERE EL_Status__c <> 'Closed' AND REcordtype.Name=:'Requisition' /*And (Id=:'a04e0000005RhypAAC' OR Id =: 'a04e0000005Rhyp')*/ AND Req_Id__c IN: reqid LIMIT 5]);
        system.debug('hellooooo'+requisitionRecMap);
        for(Id recid: requisitionRecMap .keySet()){
            //Savepoint sp = Database.setSavepoint();
            readObject(recid);                                    --->Here calling another method, hope that here i'm facing issue. so please clarify me.
           req.setBody(xmlData);
            Http http = new Http();
            req.setTimeout(60000);
             if(!test.isrunningtest()){
                HttpResponse res = http.send(req);
                resbody = res.getBody();
                System.debug('*****'+res.getBody()); // Here you will get the response
             } 
        }
    }

 
  public static void readObject(Id recid){
     rev = [SELECT Time_now__c,Time_From__c,Time_To__c FROM Recruiting_Activities__c WHERE Id=:recid LIMIT 1];
       xmlData ='<?xml version="1.0" encoding="utf-8" ?>'
                +'<AdCourierAPI>'
                +'<Method>RetrieveApplications</Method>'
                +'<APIKey>3012861772</APIKey>'
                +'<Account>'
                    +'<UserName>'+u.Username_Broadbean__c+'</UserName>'
                    +'<Password>'+u.Password_Broadbean__c+'</Password>'
                +'</Account>'
            +'</AdCourierAPI>';
       system.debug('--------'+xmlData);   
 }

So, pleaase update me with the bulkification ASAP.
Hello folks,

When Master is set to private the associated child also defaultly set to Private.
Now i have one parent record and 3 associated child records are there.
So whoever are the owners for those child records, they have to see all 3 records among themselves. So how can i achieve this situation, hope that we can achieve it by apexsharing but how it can be??

Actually, when we set as Private people cannot see others records..they can see only their records(i.e, whoever created they can see thier records). But how to achieve above scenario??

Please update me with your valuable solution :)
Hello Everyone,

I have string which is similar to datetime format but it is not matched with salesforce datetime format. 
String :: 2015-05-21T02:02:40Z
Salesforce Date Time format:: 2015-05-21T02:02:40.000+0000.

Please suggest me that how can i convert above string to salesforce date time format. It is in GMT.
Thanks!!
Hello Folks,

As am doing an integration with SAP, Netowrk team asking me about IP's and Port's.
Already provided IP Addresses but not able to provide Port numbers. So how can i know the port number for my instance( https://ap1.salesforce.com )

Your help is higly appreciated, Thanks in advance.
Hello Everyone,

While doing an integration with SAP there are firewall issues.To avoid this they were asking me the salesforce IP for my organization.

So how can i know the IP Address of my instance, its a developer org. Is it possible to find by salesforce logged in URL?
URL:: https://ap1.salesforce.com

Please suggest me with your ideas, Thanks in advance.
Hello everyone,

I have the below webservice class, but i just gave account insertion in that class. No where mentioned the username and password also. So are Third people directly invoke this code in their system?. Once they call that method is Account is going to insert in Salesforce??
Please give me some idea on this code and how can i do the integration by using webservice also?

global class AccountPlan {
      webservice String area;
      webservice String region;
//Define an object in apex that is exposed in apex web service
 global class Plan {
        webservice String name;
        webservice Integer planNumber;
        webservice Date planningPeriod;
       webservice Id planId;
  }

webservice static Plan createAccountPlan(Plan vPlan) {
     Account acct = new Account();
     acct.Name = vPlan.name;
     acct.AccountNumber = String.valueOf(vPlan.planNumber);
  insert acct;
 vPlan.planId=acct.Id;
 return vPlan;
}
}

Thanks in advance!!
Hello folks,

In wrapper class defined one variable as Decimal, but unfortunately some times i have to show string in that variable. so for this i used
 Decimal.Valueof(string.Valueof('Product is not available for sale'))
but while running class and this method i'm getting followin error i.e, 
Invalid decimal: Product is not available for sale.

public List<CPQsubWrapper> shwoingPrices{get;set;}
public class CPQsubWrapper{
           public string couponCode{get;set;}
            public Decimal actualPrice{get;set;}
}
in method added logic like:
shwoingPrices.add(new CPQsubWrapper('abc', Decimal.Valueof(string.Valueof('Product is not available for sale'))));

So please suggest me where i need to change the particulat logic.

Thank you so much in advance!!
Hello Everyone,

Iam showing records in an pageblock table by using wrapper class.
User-added image
In the above image, showing records in an table. left hand side products are parent object records and right side records are child object product feature records. For a single parent record i have to show all the associated childs in rightside column but currently in table, product is repeatly coming with every product feature. 
Actually it has to show one "Diesel Generator" in right side and "Black Colour","Brown Colour" features has to show in right side, mainly it has to show in one block. i.e, resultly it has to show like in the below image.User-added image
vf code:
<apex:pageBlockTable value="{!selectedPrdctsWithFeatures}" var="spf">
             <apex:column value="{!spf.selectedProdctname}" headerValue="Product"/>
             <apex:column headerValue="Product Features">
                     <table border="1">
                          <tr> <th><b>Select</b></th>
                                   <th><b>Colour</b></th>
                                   <th><b>Engine Capacity</b></th>
                          </tr>
                          <tr>                                
                               <td width="30%">
                                    <apex:inputCheckbox value="{!spf.selectfeature}"/>
                                </td>
                                <td align="center">
                                     <apex:outputText value="{!spf.pftr.Product_Colour__c}"/>
                                </td>
                                <td align="center">
                                    <apex:outputText value="{!spf.pftr.Engine_Capacity__c}"/>
                                </td>
                          </tr>
                    </table>
             </apex:column>
   </apex:pageBlockTable>
Class::
  for(Product_Feature__c pf: [select id,Product_Colour__c,Engine_Capacity__c,Product__r.Name,Product__r.Product_Code__c,Product__c                                                                    from Product_Feature__c where Product__c IN:cstmprdctMap.keyset()]){
                                                                                    selectedPrdctsWithFeatures.add(new CPQsubWrapper(pf.Product__r.Name,pf.Product__r.Product_Code__c,false,pf,null,null,null,null,null,null));   
   }
Please update me where can i change the logic to show my records as in second image.
 
Hello folks,

I have Discount field on PriceBook object. If i select 10 as the discount than automatically selected product "List Price" has been changed with 10% difference value.
For ex:
Discount is10 on PriceBook object, and list price is 1000 on PriceBookEntry. If i Add a product in pricebook related list with some list price value than automatically "list price" has changed to 900.

We dont have option to write a trigger on PriceBookEntry object. So how can i achieve this.

Thanks in advance.
Hello buddies,

What is Account forecast report, actually i got the requirement like::
"create a custom link on account detail page which will open Acount forecase report".

How can i set up this on account detail page?

Please advice me,
Thanks in advance.
Hello everyone,

I'm executing the approval process by apex trigger on my customobject. While inserting record i'm facing the below error:
"Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, getApproverValueFromApproversGroup: execution of BeforeInsert caused by: System.DmlException: Process failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, missing required field: [objectId]: [objectId] Trigger.getApproverValueFromApproversGroup: line 31, column 1: []"

trigger logic:
Set<Id> ordrprdctIds = new Set<Id>();
    for(RMA_Request__c r:trigger.new){
        Id prdctid=ordrPrdctMap.get(r.Order_Product__c);
        if(aprvrGrpMap.get(prdctid)!=null)
           r.Approver__c= aprvrGrpMap.get(prdctid);
        // Create an approval request for the RMA
        if(r.Status__c=='In-Progress' && r.Approver__c!=null){
            Approval.ProcessSubmitRequest req1 = new Approval.ProcessSubmitRequest();
            req1.setComments('Submitting request for RMA Approval ');
            req1.setObjectId(r.id);
            req1.setNextApproverIds(new Id[] {r.Approver__c});
           System.Debug('Approver value@@'+r.Approver__c);
            // Submit the approval request for the RMA
            Approval.ProcessResult result = Approval.process(req1);---> Error line
        }    
    }

Please assist me with your valuable solution.
Thanks in advance!!
Hi Buddies,

I want to execute our Rest Resource class from Facebook. For this scenario how can i acheive?

i want to execute fb comments or share's by using javascript from fb to call  our rest resource class, is it possible?
HI Guys,

i implemented a webservice class,it is going to retrieve records based on autonumber field. for the main class its executed successfully but it was not able to retrieve any records in test classes.

Auto number field is in User object,for this i inserted a user and than am querying on that particular user record but it was showing " System.QueryException: List has no rows for assignment to SObject "

test class :
Profile p = [select id from profile where name='Standard User'];

            User testUser= new User(alias = 'u1', email='u1@swa.com',
              emailencodingkey='UTF-8', lastname='Testing', languagelocalekey='en_US',
              localesidkey='en_US', profileid = p.Id, country='United States',
              timezonesidkey='America/Los_Angeles', username='u1@swa.com');
        
            insert testUser;
rewCls.empid==testUser.Emp_Id__c;--->Am i able to get that autonuber field after inserting the user ?
cls_RecieveAndSend_DatatoSrisys.doPost();


class:
global static MyUserDefinedClass doPost(){

if(rewCls.month==null && rewCls.year!=null && rewCls.empid!=null){
           System.Debug('Users Emp Id is '+rewCls.empid);
           
            User u = [select id,name from user where Emp_Id__c=:rewCls.empid];
            System.Debug('Users Name :'+u.Name);
}
Hi buddies,

i want to compare a multiselected picklist  value with a selected value by a Dynamic Query,but i was getting error like :

System.QueryException: expecting a left parentheses, found 'Sales User 3%'

private string salesuserquery ;

  private string  salesuser{get;set;}

My query is :

salesuserquery='select id,name,Forecast_User__c,(select id,name,Amount__c from Quotas__r) from QUX_Forecast__c where  (Select_Any_User__c includes \''+String.escapeSingleQuotes(salesuser)+'%\')';

List<QUX_Forecast__c> lstfrcstusrs = Database.query(salesuserquery);

Multi Picklist field : Select_Any_User__c

Is anyone could suggest me.
Hey buddies,

Am generating a Dashboard using Visualforce Page Tage Barseries and Pie Series etc..I want to include this Dashboard on Email Message Body.

or whatever am showing in VF page,i need to save it as pdf. See below image for viewing it on Dashboard Email body.

Either way my Manager accepted,but we were not able to implement this.Is any idea or guess to do this?

User-added image
Hi folks,

i have a small issue with finding value from selectoptions.i.e, from the URL am getting a value.Now i need to search this value in an select list(<select>) and i need to know the index of the particular value.

VF :These are select list

<select id="timeperiodname" onchange="doSearch();" >
        <option value=""></option>
        <apex:repeat value="{!allperiods}" var="accnt">
          <option value="{!accnt.name}">{!accnt.name}</option>
        </apex:repeat>
          <option value="H1">H1</option>
          <option value="H2">H2</option>
          <option value="F1">F1</option>
</select>

From the URL,am getting " H1 ".Now i need to search this value in select list and i need to find the index of the particular value.

how can i achieve this?plz,suggest me..
Hi Folks,

Am sending json format data to external system,its invoking fine.But am not able to get the response from that system.When am trying with workbench or advanced rest client(Google) its giving response properly.

But i was not able to get the response to the instance which i used(salesforce).

Here is my code : Sending Data to Extrnal sys

webService static void callExternalsysAndUpdatereward(string body){
        Http h = new Http();
         HttpRequest req = new HttpRequest();
            req.setEndpoint('xxxxxxxxxxx');
            req.setMethod('POST');
            req.setHeader('Content-Type','application/json');
            req.setBody(body);
            system.debug('Reward Data '+body);   
           // Send the request, and return a response
         HttpResponse res = h.send(req);
         system.debug('HttpResponse res '+res.getbody());
   }

in other system its invoking  properly .Class :

@RestResource(urlmapping='/RewardSearch_and_Send/*')
global class cls_RecieveAndSend_DatatoSrisys
{

    @HttpPost
    global static MyUserDefinedClass doPost()
    {
        RestRequest req = RestContext.request;
        System.debug('req  Body '+req);
        RestResponse res = RestContext.response;
        string strJSON = req.requestBody.toString();
           System.debug('Json O/P is '+strJSON);
        JSONparser parser = JSON.createParser(strJSON);    
    
        Type reqObj = Type.forName('cls_ReceivingSupport');       
        cls_ReceivingSupport rewCls=(cls_ReceivingSupport)parser.readValueAs(reqObj);
     
        MyUserDefinedClass My=new MyUserDefinedClass();
      
        if(rewCls.month==null && rewCls.year!=null && rewCls.empid!=null){
            User u = [select id,name from user where Emp_Id__c=:rewCls.empid];
            System.Debug('Users Name :'+u.Name);
            Reward__c r = [select id,name,Time_Based_Mgmnt__c,Cut_off_Percent__c,Active__c,Rward_Amount__c,User__c from Reward__c where ((User__c=:u.id) AND (CALENDAR_YEAR(Time_Based_Mgmnt__r.Start_Date__c)=:rewCls.year))];
           JSONGenerator gen = JSON.createGenerator(true);
                  gen.writeStartObject();
                  gen.writeStringField('Name',r.Name);
                  gen.writeNumberField('Reward Amount',r.Rward_Amount__c);
                  gen.writeNumberField('Cut-Off',r.Cut_off_Percent__c);
                  gen.writeStringField('Period Data',r.Time_Based_Mgmnt__c);
                  gen.writeStringField('User Data',r.User__c);
                  gen.writeBooleanField('Active',r.Active__c);
                  gen.writeEndObject();
                String jsonString = gen.getAsString();
                System.Debug('Json O/P is '+jsonString);
                My.Data='Rewards List is '+jsonString;
                My.Status='Success';
              
        }
        System.Debug('Json O/P My '+My);
      return My;
    }
  
    global class MyUserDefinedClass {     
        global String Data;      
        //global String Amount;
        global string Status;
    }
}

sending is success to another system,that system is invoking properly but am not able to get the response in first system. can anyone suggest me on this.
Hi Guys,

Am posting json text data from google advanced rest api client,but it throws error like :503 Service Unavailable

It is the Data am giving : {"rewardamnt"="15000","active_or_inactive": "true"}

Content-Type :application/json

MY URL :https://quinnoxspm-developer-edition.na15.force.com/WebMethods/services/apexrest/RewardCreation

https://quinnoxspm-developer-edition.na15.force.com -->Force.com site URL

WebMethods-->Site Name

services/apexrest-->Common for apex rest resource

RewardCreation--->My controller having urlmapping.

Hi Guys,

I want to execute some logic via developer console , because i need to sum up child values and i need to show it in Parent object.for this my logic is,

set<Id> actids = new set<Id>();
List<opportunity> lstopps=[select id,name,closedate,expectedrevenue,accountid from opportunity ];
for(opportunity o:lstopps){
    if(o.closedate.year()==Integer.valueof('2014')){
  actids.add(o.accountid);
    }
}
Map<Id,Account> acctsmap = new Map<Id,Account>([select id,name,Total_Revenue__c from account where id IN:actids]);
for(Account a:acctsmap.values()){
a.Total_Revenue__c=0;
}
if(actids.size()>0){
for(opportunity o:[select id,name,closedate,expectedrevenue,accountid from opportunity where accountid =:actids]){
Account ac=acctsmap.get(o.accountid);
 
    if(ac.Total_Revenue__c!=0){
     ac.Total_Revenue__c+=o.ExpectedRevenue;
    }else{
     ac.Total_Revenue__c=o.ExpectedRevenue;
    }
 
  }
}
update acctsmap.values();
Hi buddys,

I have a VF page like the below one.Now when i am going to click on "OK" Button,i need to download that XML file and  i need to insert that XML file in related Attachments.Any idea...

<apex:page showHeader="false" controller="CLS_xmlGeneration" tabStyle="Reward__c">
    <apex:form >
        <apex:pageBlock mode="edit">
            <apex:pageBlockSection collapsible="false">
                <apex:outputText value="{!xmldata}" style="width:1000px;"></apex:outputText>
            </apex:pageBlockSection>
            <apex:pageBlockButtons location="bottom">
                <apex:commandButton value="Back" onclick="window.top.close();"/>
                <apex:commandButton value="OK" onclick="window.open('/{!recid}?export=1&enc=UTF-8&xf=csv');"/>
            </apex:pageBlockButtons>
        </apex:pageBlock>
    </apex:form>
</apex:page>


XML :
<?xml version="1.0"?><Reward><Id>a04i000000AhEc8AAF</Id><Name>R-0001</Name><UserId>005i0000002hsAbAAI</UserId><TimeId>a01i000000AoSiWAAV</TimeId><RewardAmount>500</RewardAmount></Reward>
Hi ,

In Parent Object (QUX_Forecast__c), i have Total Amount Field
In Child Object(Quota__c) , i have Amount Field
I am writing a trigger on Child Object for whenever a record is created or updated i need to compare parent value with all childs amount.
If  All childs amount is greater than parent Total Amount Field,i need to show a error message.
For this i wrote a code,but it is taking all child values along with current updated record.


trigger to_ShowError on Quota__c (before insert,before update) {

    set<Id> prntids = new set<Id>();
    for(Quota__c q:trigger.new){
        if(q.QUX_Forecast__c!=null){
            prntids.add(q.QUX_Forecast__c);
        }
    }
  
    Map<Id,QUX_Forecast__c> prntrecs= new Map<Id,QUX_Forecast__c>([select id,name,Time_Based_Mgmnt__c,Total_Amount__c
                                    from QUX_Forecast__c where id IN:prntids]);

     List<Quota__c> lreslts =[select q.id,q.Amount__c,q.QUX_Forecast__c from Quota__c q where (q.QUX_Forecast__c IN:prntids)];
      double childamnttotal;
      for(Quota__c a:lreslts){
          if(childamnttotal!=null){
              childamnttotal=double.valueof(a.Amount__c)+childamnttotal;
            
          }else {
              childamnttotal=double.valueof(a.Amount__c);
          }
      }
      for(Quota__c q:trigger.new){
         QUX_Forecast__c qfc = prntrecs.get(q.QUX_Forecast__c);
         if(qfc.Total_Amount__c!=null){
         system.Debug('Parent Amnt is '+qfc.Total_Amount__c);
         system.Debug('Total Child Amnt is '+childamnttotal);
             if(qfc.Total_Amount__c<childamnttotal){
                q.Amount__c.addError('You need to check with selected Parent Total Amount');
             }
         }
      }                            
}

I understood that , It is the issue with trigger.newmap.keyset() and oldmap.keyset() . if i use newmap.keyset() , iam not able to take current val for comparison.Please help me out with exact query and logic.
Hello Everyone,

In my system there are 2 laksh records, in that 5000 records are deleted by user1. Now i want to undele only those 5000 records which are deleted by user1. How can i build the query for that. Also is it possible to un-delete the records by record deleted date. 

Thanks Much.
Hello Every one,

When i click on a button in visualforce page, it has to capture the screenshot of the page and it has to send an email to some user. How can i achieve this?? I tried in different ways but strucked in some protions. Will you share your idea or any solution for this.

Thanks in advance !!
Hello Everyone,

We all know what are the best practices for the Development and Admin. I prepared a Best Practices doc with all of the points for Development. Just like that i was trying to prepare a doc for Admin, but not able to put all points together. So can anyone post the links which has all points for Admin and Configuration

Thanks in advance !!!
Hello Folks,

I was facing an issue with my loading  of visualforce page. I have executed the javascript, from the javascript iam executing action method. After executing that action method, again my page is reloading but i just want to stop after execution of action method.

In the end of my action method the below code is executing correctly::
if(prdctsWithQuantity.size()>0){
              currentStep='2';  
 }

VF Page:
<script type="text/javascript">
        function showRelatedProducts(slctrcrd){
             var eterm=document.getElementById('{!$Component.frm:pb0:pblksctn:pbsitm:pfmly}').value;
              if(eterm=='')
              {
                  alert('You have to Select Product Family');
              }
              else{
                     callprdcts();
              }
    }
</script>
  <apex:actionFunction action="{!showSelectedProductFamilyRecords}" name="callprdcts" reRender="frm"/>

Actually it is showing the second step page, but again coming back to first step page. How to stop after the above logic execution..

Suggest me, Thanks in advance !!
Hello Team,

Iam able to see schedule refresh option for the dashboard but am not able to see "users" in the drop-down for sending email to particular user. Even iam not able to see this option for Admin Users. So am i need to give any permission to profile?? Please suggest me

Thanks in advance!!
User-added image
Hello Everyone,

While doing callout getting the error :: 
System.CalloutException: You have uncommitted work pending. Please commit or rollback before calling out .

Actually i am sending request to 3rd party system based on the response iam upserting records in salesforce.
When i was doing with 1 record, it is working fine. But when i tried with bulkified manner getting the above error.

So while research i got an idea that i need to seperate the transactions for both the Callout's and DML's.
Is there any function or method that callout has been done, with that i can seperate both the transactions for DML's in salesforce and Callouts

How can i avoid this particular error??  Please suggest me !!!
Hello Everyone,

While doing an integration with SAP there are firewall issues.To avoid this they were asking me the salesforce IP for my organization.

So how can i know the IP Address of my instance, its a developer org. Is it possible to find by salesforce logged in URL?
URL:: https://ap1.salesforce.com

Please suggest me with your ideas, Thanks in advance.
Hello everyone,

I have the below webservice class, but i just gave account insertion in that class. No where mentioned the username and password also. So are Third people directly invoke this code in their system?. Once they call that method is Account is going to insert in Salesforce??
Please give me some idea on this code and how can i do the integration by using webservice also?

global class AccountPlan {
      webservice String area;
      webservice String region;
//Define an object in apex that is exposed in apex web service
 global class Plan {
        webservice String name;
        webservice Integer planNumber;
        webservice Date planningPeriod;
       webservice Id planId;
  }

webservice static Plan createAccountPlan(Plan vPlan) {
     Account acct = new Account();
     acct.Name = vPlan.name;
     acct.AccountNumber = String.valueOf(vPlan.planNumber);
  insert acct;
 vPlan.planId=acct.Id;
 return vPlan;
}
}

Thanks in advance!!
Hello Everyone,

Iam showing records in an pageblock table by using wrapper class.
User-added image
In the above image, showing records in an table. left hand side products are parent object records and right side records are child object product feature records. For a single parent record i have to show all the associated childs in rightside column but currently in table, product is repeatly coming with every product feature. 
Actually it has to show one "Diesel Generator" in right side and "Black Colour","Brown Colour" features has to show in right side, mainly it has to show in one block. i.e, resultly it has to show like in the below image.User-added image
vf code:
<apex:pageBlockTable value="{!selectedPrdctsWithFeatures}" var="spf">
             <apex:column value="{!spf.selectedProdctname}" headerValue="Product"/>
             <apex:column headerValue="Product Features">
                     <table border="1">
                          <tr> <th><b>Select</b></th>
                                   <th><b>Colour</b></th>
                                   <th><b>Engine Capacity</b></th>
                          </tr>
                          <tr>                                
                               <td width="30%">
                                    <apex:inputCheckbox value="{!spf.selectfeature}"/>
                                </td>
                                <td align="center">
                                     <apex:outputText value="{!spf.pftr.Product_Colour__c}"/>
                                </td>
                                <td align="center">
                                    <apex:outputText value="{!spf.pftr.Engine_Capacity__c}"/>
                                </td>
                          </tr>
                    </table>
             </apex:column>
   </apex:pageBlockTable>
Class::
  for(Product_Feature__c pf: [select id,Product_Colour__c,Engine_Capacity__c,Product__r.Name,Product__r.Product_Code__c,Product__c                                                                    from Product_Feature__c where Product__c IN:cstmprdctMap.keyset()]){
                                                                                    selectedPrdctsWithFeatures.add(new CPQsubWrapper(pf.Product__r.Name,pf.Product__r.Product_Code__c,false,pf,null,null,null,null,null,null));   
   }
Please update me where can i change the logic to show my records as in second image.
 
Hello buddies,

What is Account forecast report, actually i got the requirement like::
"create a custom link on account detail page which will open Acount forecase report".

How can i set up this on account detail page?

Please advice me,
Thanks in advance.
Hello everyone,

I'm executing the approval process by apex trigger on my customobject. While inserting record i'm facing the below error:
"Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, getApproverValueFromApproversGroup: execution of BeforeInsert caused by: System.DmlException: Process failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, missing required field: [objectId]: [objectId] Trigger.getApproverValueFromApproversGroup: line 31, column 1: []"

trigger logic:
Set<Id> ordrprdctIds = new Set<Id>();
    for(RMA_Request__c r:trigger.new){
        Id prdctid=ordrPrdctMap.get(r.Order_Product__c);
        if(aprvrGrpMap.get(prdctid)!=null)
           r.Approver__c= aprvrGrpMap.get(prdctid);
        // Create an approval request for the RMA
        if(r.Status__c=='In-Progress' && r.Approver__c!=null){
            Approval.ProcessSubmitRequest req1 = new Approval.ProcessSubmitRequest();
            req1.setComments('Submitting request for RMA Approval ');
            req1.setObjectId(r.id);
            req1.setNextApproverIds(new Id[] {r.Approver__c});
           System.Debug('Approver value@@'+r.Approver__c);
            // Submit the approval request for the RMA
            Approval.ProcessResult result = Approval.process(req1);---> Error line
        }    
    }

Please assist me with your valuable solution.
Thanks in advance!!
Hi Guys,

Am posting json text data from google advanced rest api client,but it throws error like :503 Service Unavailable

It is the Data am giving : {"rewardamnt"="15000","active_or_inactive": "true"}

Content-Type :application/json

MY URL :https://quinnoxspm-developer-edition.na15.force.com/WebMethods/services/apexrest/RewardCreation

https://quinnoxspm-developer-edition.na15.force.com -->Force.com site URL

WebMethods-->Site Name

services/apexrest-->Common for apex rest resource

RewardCreation--->My controller having urlmapping.

I have been trying to connect Salesforce and Google API using server to server application.

 

Intent :- To communicate data between Salesforce and Google Spreadsheet which is hosted in Google Sites and using some Google Forms, Google scripts and triggers to update data.

 

So, for doing this I need a server to server application model from Google as it wouldnt require a consent from user while its communicating data. for doing this I need to create a JWT and pass it to Google to get the token and proceed with the next steps.

 

JWT for Google requires a RSA with SHA256 signing of the msg using the private key that google has provided in the certificate when I created the server to server application in Google.

I havent found this info anywhere till now :(

In salesforce, we have a crypto class in which can sign with RSA SHA1 (or) generate digest with SHA256, I tried generating a digest using SHA256 and signing that digest usng RSA and the private key given by google. Even thats not working.

 

Google isnt accepting my assertion values (JWT) and its returning an invalid Grant message.

 

I have seen that Jeff douglas has posted some information about this here :-http://blog.jeffdouglas.com/2010/07/06/using-rsa-sha1-with-salesforce-crypto-class/

But unfortunately he has mentioned about domain model and asking us to upload a certificate to google, which i dont want to do or which is not my scenario.

 

Also Google requires a UT8 base64 URL encoded value at all places as mentioned in this link :-https://developers.google.com/accounts/docs/OAuth2ServiceAccount#libraries But salesforce has a separate URL encoding and a separate base64encoding method available in the EncodingUtil class.

 

I have a C# dotnet application which is generating the same value and its able to hit Google and get the value properly. But uses the certificate file and gets the privatekey directly. I used openssl to retrieve the privatekey from the .p12 certificate file provided by Google and have pasted it in my code. I am sure there is some problem in the signing part, because when I compare the values generated by my .NET application and Salesforce Apex code, its returning correct values, but when it comes to the signature part, the length is also same for the returned data (signature) from both .NET and SF but Google returns an invalid grant while calling from SF but returns a bearer token when I call it from my .NET application.

 

public class TestRestAPICall
{
    public class JWTClaimSet
    {
       public string iss {get;set;}
       public string scope {get;set;}
       public string aud {get;set;}
       public Long exp {get;set;}
       public Long iat {get;set;}
       //public string prn {get;set;}
    }

//@future (callout=true)
public static void LoginToGoogle()
{
    //Set your username and password here        
    String clientId = '851234545868.apps.googleusercontent.com';

    //Construct HTTP request and response
    Http http = new Http();
    HttpRequest req = new HttpRequest();
    HttpResponse res = new HttpResponse();


    String JWTHeader =  '{"typ":"JWT","alg":"RS256"}';
    //String Base64EncodedJWTHeader = 'eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9'; //To encode later using code

    //Taken from .net application
// Since the information is going to be same, I have encoded it already in .NET and using it here
    String Base64EncodedJWTHeader = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9';
// Salesforce returns time in milliseconds, so we are dividing it by 1000 to set the seconds value instead of milliseconds value
    Long expires_at = math.roundToLong(DateTime.now().addMinutes(40).getTime() / 1000);
    Long issued_at = math.roundToLong(DateTime.now().addSeconds(-2).getTime() / 1000);
    //Long issued_at = 1372276504;
    //Long Expires_at = 1372279804;

    JWTClaimSet JWT = new JWTClaimSet();
    //JWT.prn = username;
    JWT.iss = '851234545868@developer.gserviceaccount.com';
    JWT.scope = 'https://www.googleapis.com/auth/drive.file';
    JWT.aud = 'https://accounts.google.com/o/oauth2/token';
    JWT.iat = issued_at;
    JWT.exp = expires_at;

    String strJWTJSON = JSON.Serialize(JWT);
    system.debug('Unencoded claimset::'+strJWTJSON);


    Blob ClaimsetBlob = Blob.valueOf(strJWTJSON);
    String Base64EncodedClaimset = EncodingUtil.base64Encode(ClaimsetBlob);
    //Base64EncodedClaimset = PerformPostBase64Encode(Base64EncodedClaimset);
    system.debug('Base64 Encoded Claimset::'+Base64EncodedClaimset);

    // constructing the base64 encoded string to sign it
    string Base64EncodedString = Base64EncodedJWTHeader + '.' + Base64EncodedClaimset;


    // Steps to sign the base64Encoded string
    String algorithmName = 'RSA';
    String key = 'MIICXAIBAAKBgQCi16h+5TeQU5Fo0DlR6+YmrzYXZ7DLxz+dBEnB8Hj0gznqlz8p7nQ7I4AV/SfiJQ6JbU16sKS5IW7Hob5ieW1DfwxYZeCSBPbEkt7eASrI8xqGU5RVewaQivY3vO+avgSSUT+ZU243XsDvZJQlkE3e46FhBvFedDQvuk2iEfgdxQIDAQABAoGAFaO882f4c0h3qUsKYvWLNxbPhFq2Js5KiM4aEximqi+KEb+ZmDPk5Dr6eXGTzDyKav7IbgZtTWDA/OxkhWeHelsMB9LqBq50L6hLHTK4hHecPrT3oN4GviUXh5y5Vt479A1TopjLKdt7V4AnAs0HEWJzar/euUa+T9eODPWPFP0CQQDWQeK2cqzWSVHUpkufp7a0Sc2RvfcIpOf8kRFBLnKiFGr7BscLz6qsaG1M8TyUNMrCquwLSNSDMvPjl6sCjgRPAkEAwpFx8+lspjN0yV5M5XHPmnoddTHwV/8QHoccMBBq0ZMFs2m1E/rFhwMHRBiFN6flbze8src7YnOmmtYqsGizqwJAfqoEtYel1ikST3zgSEqGIJ9hAEAlwt56pz27zaT/8AHSHQUstzbV14cE1u/muFddZyhU03cC62078djAKIp80QJAKMMT3ofOrVsmYnGRJpibZ7+hoEXgFm9nTx37N86YsmNc1GOW/iKRc2GdChUhA7H3DT/eForwtAWKp/Gqa97jlQJBAKjKOIKvdYS9fTpCzs1nUHg9rvVartRR5xxwLH57bBincuSJSBGjwd1FInAh2tgiUGPWGPsplShP87wao9+n9VQ=';
    Blob privateKey = EncodingUtil.base64Decode(key);

    Blob input = Blob.valueOf(Base64EncodedString);
    //Blob SHA256InputBlob = Crypto.generateDigest('SHA-256',input);

    Blob Blobsign = Crypto.sign(algorithmName, input , privateKey);


    // The following line is just for debugging and viewing the blob data in signature as string and its not used anywhere
    String signature = EncodingUtil.urlEncode(EncodingUtil.convertToHex(Blobsign),'UTF-8');

    system.debug('Unencoded signature ::'+signature);
    String base64EncodedSignature = EncodingUtil.base64Encode(Blobsign); 
    //base64EncodedSignature = PerformPostBase64Encode(base64EncodedSignature);
    system.debug('Base 64 encoded signature ::'+base64EncodedSignature );

    system.debug('Encoded assertion : ' + Base64EncodedString+'.'+base64EncodedSignature);

    string URLEncodedUTF8GrantType = encodingUtil.urlEncode('urn:ietf:params:oauth:grant-type:jwt-bearer','UTF-8');
    string URLEncodedUTF8Assertion = encodingUtil.urlEncode(Base64EncodedString+'.'+base64EncodedSignature,'UTF-8');        

    system.debug('URLEncodedUTF8GrantType : ' + URLEncodedUTF8GrantType);
    system.debug('URLEncodedUTF8Assertion : ' + URLEncodedUTF8Assertion);

    //Making the call out
    req.setEndpoint('https://accounts.google.com/o/oauth2/token');
    req.setMethod('POST');
    //req.setHeader('Content-Length', '-1');
    req.setHeader('Content-Type','application/x-www-form-urlencoded');
    //req.setHeader('grant_type',URLEncodedUTF8GrantType);
    //req.setHeader('assertion',URLEncodedUTF8Assertion);
    req.setBody('grant_type='+URLEncodedUTF8GrantType+'&assertion='+URLEncodedUTF8Assertion);
    res = http.send(req);
    system.debug('Response : '+res.getBody());
}

 public static String PerformPostBase64Encode(String s)
 {
    s = s.Replace('+', '-');
    s = s.Replace('/', '_');
    s = s.Split('=')[0]; // Remove any trailing '='s
    return s;
 }
}

 

 

I have also posted my problem at stackexchange, it would be great if anyone could help me out :-

 

http://salesforce.stackexchange.com/questions/13301/connect-apex-and-google-api-using-jwt-to-retrieve-oauth-2-0-token