• Bhushan.Adhikari
  • NEWBIE
  • 80 Points
  • Member since 2014

  • Chatter
    Feed
  • 2
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 19
    Replies
public interface PurchaseOrder {
    Double discount();
  }
  
public class CustomPurchaseOrder implements PurchaseOrder {
  
    static final double DEFAULT_DISCOUNT = .05;
        
    public Double discount() {
      return DEFAULT_DISCOUNT;
    }
      
 }

can some one help me out  (for the bello w trigger i am facing this problem)


trigger auto_con_led on Account (before insert)
{
//set<id>set1=new set<id>();
//list<account>ac=new list<account>();
list<contact>co=new list<contact>();
if(trigger.isinsert)
{
  for(account a:trigger.new)
  {if (a.name!=null)
   {contact c=new contact();
     c.lastname='jansi';
     c.accountid=a.id;
   co.add(c);
   }}
}
update co;
}
  • August 18, 2014
  • Like
  • 0
Hello,

I am having a button on a vf page which redirects to a new event with pre pouplated values using URL
for eg the redirect url is as below :
https://cs10.salesforce.com/00U/e?00NJ0000001Idi3=On-Boarding&evt2=Bhushan+Adhikari&evt2_lkid=003J000000zd38DIAQ&evt5=On-Boarding

the above url opens a event page with Contact pre propulated to Bhushan Adhikari. So as a admin when i click on 'Add Invitee' link beside the contact field, the contact record is added to the invitee. But if try same thing using a different profile(Licence: Force.com One App) the 'Add Invitee' link does not work directly. I have to click on the lookup icon .. select the contact and then click on 'Add Invitee'. 

Any Idea why it is working fine with admin(without having to select contact from lookup) profile and but not with other profile.

Regards,
Bhushan A
Hello,

I am working with twitter integration and when i do a callout i get a response with a datestamp as 'Tue Jul 29 05:32:57 +0000 2014'. So I am looking for a way in salesforce to parse this date and convert it to a proper dateTime format. 
Any suggestions?

Regards,
Bhushan A
Hi,

We have a vf page form that has an inputfile tag for uploading image, along with that on the form we have a commandlink that call a javascript method that calles the controller save method and onComplete of this we call a controller method that does a webservice callout. 

So when i click on the command link i get a error saving apex:inputFile can not be used in conjunction with an action component, apex:commandButton or apex:commandLink that specifies a rerender or oncomplete attribute.

after reading certain posts i tried putting the commandlink and actionFunctions in actionRegion tag.. and now the above error has gone, but I get a new error saying "You have uncommitted work pending. Please commit or rollback before calling out" 

below is my vf code snippet
<apex:page>
 <apex:form>
<label>Profile Picture (Dimensions 324 x 219 pixels)<span>*</span></label>
<apex:inputFile value="{!document.body}" filename="{!document.name}" id="file"/>
<apex:commandLink styleClass="social" onclick="SaveRecord_JS();return false;"/>
<apex:actionFunction action="{!save}" name="SaveRecord_JS" oncomplete="CallWebService_JS();"/> 
<apex:actionFunction action="{!authorize}" name="CallWebService_JS"/>
</apex:form>
</apex:page>

if i used above code i get 'apex:inputFile can not be used in conjunction..' error 
and if i put commant link and actionfunction under  <apex:actionregion> tag.. i get callout exception.

Any idea how to overcome this both errors?

Regards,
Bhushan 

Hello,

I am having an requirement where in I have to calculate the difference between two values on different records of same object. For example lets say I have a number field on an object where its value is 150 on one record and the other record has value as 160 , so the difference here is 10(160-150 = 10). And most importantly I have calulate this based on the owner of the records.


I am looking to parse the below json response using Json deserializing

{
  "_total": 9,
  "values": [
    {
      "_key": "1050817",
      "group": {"id": "1050817"}
    }
  ]
}

The issue i am facing that I cannot declare a variable of name _total , it gives me an error saying no viable alternative at character '_' . Any idea how I can parse the above Json to get the value of total.
Hello All,
 i want to insert records in salesforce through data loader command prompt as batch at a perticular time.
how to create batch file to insert records in salesforce from dataloader through command prompt....
suggestions are most welcome......
public interface PurchaseOrder {
    Double discount();
  }
  
public class CustomPurchaseOrder implements PurchaseOrder {
  
    static final double DEFAULT_DISCOUNT = .05;
        
    public Double discount() {
      return DEFAULT_DISCOUNT;
    }
      
 }
Hi

I have some doubts in data import/export please check ...

1. I want to import data from a remote server to SFDC.I can deploy a csv file  in my server.Is there any way to import automatically
    these data in SFDC Objects?Means I want to schedule a time interval for importing that data in SFDC.
   
2. The next is I want to export sales force data to my server with the scheduled time interval.

Let me know Is that possible in SFDC?
  • October 10, 2014
  • Like
  • 0
{!REQUIRESCRIPT("/soap/ajax/14.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/14.0/apex.js")}

var r = confirm(" Are you sure to call the apex class ?");
if(r == true)
{

sforce.apex.execute("javasclass","check",{str:'Amit'});
alert("Sent it for class");
}

---------------------------------------------------
global class javasclass {

    webservice static void check(string x){
       
        system.debug('this is x '+x);
    }
}

-----------------------------------------------
It gives a error :

  User-added image
Hi folks,
        Can anyone tell me the purpose of apex scheduler and how to use apex scheduler?
give me the simple example for that?


Thanks in advance
Karthick
Hi I am trying to implement this to show case history through GenericHistoryComponent and GenericHistoryComponentController at my visualforce page through below metion syntex :

<apex:tab label="Case Histories" name="GenericHistoryComponent">
         <c:GenericHistoryComponent recordLimits="50" myObjects="{!Case.Id}"/>
</apex:tab>

Once I clicked on a particular case I got a Visualforce error msg "Cannot convert the value of '{!myObject}' to the expected type".

if use below mention attrubute syntex in GenericHistoryComponent code

<apex:attribute name="myObjects" type="SObject" description="Object we wish to view the history of" required="true" assignTo="{!myObject}" />
<apex:attribute name="recordLimits" description="Number of lines of history to display" type="Integer" required="false" assignTo="{!recordLimit}" />

Please help
Dear friends,

I have a map(integer, list) and a picklist on page with these integers (plus some extra values not present as kep in map). When user selects a value, related list should be diplayed in pageblocktable. If there's no list associated, error should be displayed and pageblocktable should not be visible at all. I have written below code which works file till user selects a value not present as key in the map. Also, in real scenario, it is possible that there's no data inobject and hence, map is empty.. in that case, neither the pageblocktable, nor the picklist should be visible. Can someone please help. It's quite urgent. Below is the code..

*********** Page ************

<apex:page controller="test">
<apex:form >

    <apex:pageMessage detail="{!sError}" severity="Warning" rendered="{!sError <> null}" strength="1" title="No Data" id="message"/> 
   
    <apex:outputPanel rendered="{!isDataPresent == true}">
    <apex:pageblock id="table" >
    <apex:pageblocktable value="{!Data}" var="m"  >
       
        <apex:column value="{!m}" headerValue="Text"/>
    </apex:pageblocktable>
    </apex:pageblock>
    </apex:outputPanel>

    <apex:outputLabel value="Payment Year" ></apex:outputLabel> &nbsp; &nbsp;
    <apex:selectlist id="pmname" value="{!selectedNumber }" multiselect="false" size="1" >
        <apex:selectoptions value="{!listYearsForPage }" >
        </apex:selectoptions>
        <apex:actionSupport event="onchange" reRender="table,message"/>
    </apex:selectlist>


</apex:form>
</apex:page>


**************** Controller ****************

public class test {
   
    public List<SelectOption> listYearsForPage {get;set;}
    public string selectedNumber {get;set;}
    public boolean isDataPresent {get;set;}
    public string sError {get;set;}
   
    public test()
    {
        listYearsForPage = new List<SelectOption>();
        listYearsForPage.add(new selectoption('1','1'));
        listYearsForPage.add(new selectoption('2','2'));
        listYearsForPage.add(new selectoption('3','3'));
        listYearsForPage.add(new selectoption('4','4'));
        isDataPresent = true;   
    }
   
    public map<integer, list<string>> perpData()
    {
        map<integer, list<string>> a = new map<integer, list<string>>();
        a.put(1,new List<String>{'a','b','c'});
        a.put(2,new List<String>{'d','e','f'});
        a.put(3,new List<String>{'g','h','i'});
       
        return a;
    }
   
    public list<string> getData()
    {
        sError = null;
        list<string> l = new list<String>();
        if(selectedNumber == null)
            selectedNumber = '1';
        l = perpData().get(Integer.valueOf(selectedNumber));
        if(l != null)
            isDataPresent = true;
        else {
            isDataPresent = false;
            sError = 'No data';
        }   
        return l;
    }
   
}

can some one help me out  (for the bello w trigger i am facing this problem)


trigger auto_con_led on Account (before insert)
{
//set<id>set1=new set<id>();
//list<account>ac=new list<account>();
list<contact>co=new list<contact>();
if(trigger.isinsert)
{
  for(account a:trigger.new)
  {if (a.name!=null)
   {contact c=new contact();
     c.lastname='jansi';
     c.accountid=a.id;
   co.add(c);
   }}
}
update co;
}
  • August 18, 2014
  • Like
  • 0
Hi,

We have a vf page form that has an inputfile tag for uploading image, along with that on the form we have a commandlink that call a javascript method that calles the controller save method and onComplete of this we call a controller method that does a webservice callout. 

So when i click on the command link i get a error saving apex:inputFile can not be used in conjunction with an action component, apex:commandButton or apex:commandLink that specifies a rerender or oncomplete attribute.

after reading certain posts i tried putting the commandlink and actionFunctions in actionRegion tag.. and now the above error has gone, but I get a new error saying "You have uncommitted work pending. Please commit or rollback before calling out" 

below is my vf code snippet
<apex:page>
 <apex:form>
<label>Profile Picture (Dimensions 324 x 219 pixels)<span>*</span></label>
<apex:inputFile value="{!document.body}" filename="{!document.name}" id="file"/>
<apex:commandLink styleClass="social" onclick="SaveRecord_JS();return false;"/>
<apex:actionFunction action="{!save}" name="SaveRecord_JS" oncomplete="CallWebService_JS();"/> 
<apex:actionFunction action="{!authorize}" name="CallWebService_JS"/>
</apex:form>
</apex:page>

if i used above code i get 'apex:inputFile can not be used in conjunction..' error 
and if i put commant link and actionfunction under  <apex:actionregion> tag.. i get callout exception.

Any idea how to overcome this both errors?

Regards,
Bhushan 

Hi All,

i'm new to apex code. I'm trying to update the fields Pending_Activation_Date__c and Pending_Deactivation_Date__c on the Order__c object using a trigger. my Asset object has a reference to Order_Line_Item__c object which in-turn has a reference to Order__c object. the trigger is firing on update of Asset Object. below is the trigger code from eclipse IDE.

trigger UpdateOrder on Asset (Before Update) {
    Order_Line_Item__c tempOrderLine;
    Order__c tempOrder, OrderToUpdate;
   
if(trigger.isBefore)
    {
     System.debug('Inside UpdateOrder');
        //It will update the pending Activation and pending deactivation picklists on order object
        for(Asset astObj : trigger.new)
        {
         System.debug('Processing Asset Id '+astObj.id);
         tempOrderLine = [select order_line_item__r.id from Asset where Asset.Id =: astObj.Id limit 1];
         System.debug('Corresponding Order Line Item '+tempOrderLine.Name);
         tempOrder= [select order__r.id from Order_Line_Item__c where id =: tempOrderLine.id limit 1];
         System.debug('Corresponding Order '+tempOrder.Name);
         OrderToUpdate = [select Pending_Activation_Dates__c, Pending_Deactivation_Dates__c from Order__c where order__c.id=:tempOrder.Id limit 1];
         if(astObj.ActivationDate__c!=null){
          tempOrder.Pending_Activation_Dates__c='M6 Effective From Dates';
         }
         if(astObj.UsageEndDate!=null){
          tempOrder.Pending_Deactivation_Dates__c='M6 Effective To Dates';
         }
        }
        if(OrderToUpdate.Id!=null){
         update OrderToUpdate;
        }
       
    }
}

but Eclipse is keep showing error of Save error: Illegal assignment from LIST<Asset> to SOBJECT:Order_Line_Item__c
on this line.
tempOrderLine = [select order_line_item__r.id from Asset where Asset.Id =: astObj.Id limit 1];

now Since this line is inside the for loop, the asset object should not be a list, it can always be a single object from the list of Asset objects from Trigger. not sure why this error is coming. can you please help me... also this trigger is firing but no lines are executing. below is the debug log for its firing sequence.

01:07:41.140 (140215573)|EXECUTION_STARTED
01:07:41.140 (140248778)|CODE_UNIT_STARTED|[EXTERNAL]|TRIGGERS
01:07:41.140 (140279864)|CODE_UNIT_STARTED|[EXTERNAL]|01qL00000004Y3K|UpdateOrder on Asset trigger event BeforeUpdate for [02iL00000003pZF]
01:07:41.010 (141930232)|CUMULATIVE_LIMIT_USAGE
01:07:41.010|LIMIT_USAGE_FOR_NS|(default)|
  Number of SOQL queries: 0 out of 100
  Number of query rows: 0 out of 50000
  Number of SOSL queries: 0 out of 20
  Number of DML statements: 0 out of 150
  Number of DML rows: 0 out of 10000
  Maximum CPU time: 0 out of 10000
  Maximum heap size: 0 out of 6000000
  Number of callouts: 0 out of 10
  Number of Email Invocations: 0 out of 10
  Number of fields describes: 0 out of 100
  Number of record type describes: 0 out of 100
  Number of child relationships describes: 0 out of 100
  Number of picklist describes: 0 out of 100
  Number of future calls: 0 out of 10

01:07:41.010|CUMULATIVE_LIMIT_USAGE_END

01:07:41.142 (142006686)|CODE_UNIT_FINISHED|UpdateOrder on Asset trigger event BeforeUpdate for [02iL00000003pZF]

Your help is greatly appreciated. Thanks!

Regards,
Dipil Jain
When i'm trying to execute in Query Editor, i'm getting this exception.

Select Closed,Pipeline,OpportunityRollupPipeline,OwnerId,Quota,StartDate from RevenueForecast

Thanks for your support in Advance...
  • July 01, 2014
  • Like
  • 0
Hello,

I am having an requirement where in I have to calculate the difference between two values on different records of same object. For example lets say I have a number field on an object where its value is 150 on one record and the other record has value as 160 , so the difference here is 10(160-150 = 10). And most importantly I have calulate this based on the owner of the records.


is it possible to do insert operation inside a constructor..plz suggest
I am looking to parse the below json response using Json deserializing

{
  "_total": 9,
  "values": [
    {
      "_key": "1050817",
      "group": {"id": "1050817"}
    }
  ]
}

The issue i am facing that I cannot declare a variable of name _total , it gives me an error saying no viable alternative at character '_' . Any idea how I can parse the above Json to get the value of total.
I'm working on an integration between our client's Salesforce org and a third party.  They have a few REST API's that I need to call from Apex code and receive back some JSON data.  They have provided pretty good documentation.  They are using OAuth 2.0 for authentication.  The code will need to be run on a scheduled basis and may also be initiated by a user.  I'm a pretty skilled Windows developer in a variety of languages but am new to the force.com platform.  Any resources or sample code you could point me at would be much appreciated.