• giri rockzzzz
  • NEWBIE
  • 35 Points
  • Member since 2010

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 35
    Questions
  • 18
    Replies

Hi,

I am trying to write an update trigger for the following requirement:

 

I have a custom object purchase order lines which has the fields:Received Quantity,Purchase order Receipt(lookup) ,Product(lookup).
I have another custom object Product_Serial which has the following fields:Purchase order Receipt(lookup) ,Product(lookup).

 

Now whenever the received quantity on the purchase order line is updated,I want an  after update trigger to be fired that does:

 

*Check the count of product serial records having the product and purchase order receipt combination .
*For example, the received quantity was initially 4 and there are 4 product serial records.When the received quantity is updated to 6, the update trigger is fired
and it first  checks that i have 4 product serials for this product and  purchase_order_receipt combination.
*So i have to create 6-4 =2 product serial records  with this product and purchase_order_receipt combination.

 

 

I have tried to create the trigger for this as follows.but iam unable to get this to work.please help me!

 

 

trigger createserial on Purchase_Order_Line__c (after update)
//Trigger to get fired when a purchase order line record is updated.


{
public Purchase_order_line__c[] pol = Trigger.new;
//Create a variable reference to the object fired by the trigger.

 

Integer serialcount =[select count() from product_serial__c where product__c in
 (select product__c from purchase_order_line__c where id=:pol.id) and purchase_order_receipt__c in (select purchase_order_receipt_c from  purchase_order_line__c where id=:pol.id )];
//Get the count of product serial records for the selected purchase_order_line

 

Integer diff=pol.received_quantity__c-serialcount;

//Get the difference of records to determine if any new product serial records are to be created.

for (integer i=0 ;i<diff;i++){


Product_serial__c  obj = new Product_serial__c(
product__c=pol.product__c,
purchase_order_receipt__c=pol.purchase_order_receipt__c);
//create new product serial records


insert obj;
//insert is placed in loop so that for each iteration the record is inserted.
}

 

}

Hi All,

I would like to know if Salesforce Employee community profile have API access to integrate with External applications.

Thank you!

Hi,
I am trying to update parent event record after the recurring child event records are created.
So, in trigger i am fetching RecurrenceActivityId and query for the  parent event record using RecurrenceActivityId.
During updating the parent event record i am facing internal server error:
An internal server error has occurred An error has occurred while processing your request. The salesforce.com support team has been notified of the problem. If you believe you have additional information that may be of help in reproducing or correcting the error, please contact Salesforce Support. Please indicate the URL of the page you were requesting, any error id shown on this page as well as any other related information. We apologize for the inconvenience.

Below is my trigger code:
trigger DemoEvent on Event (after insert) {
  List<Event> evs = Trigger.new;
  Set<id> ids = new Set<id>();
  System.debug('evs = '+evs);
  for(Event e: evs){
      system.debug('RecurrenceActivityId= '+e.RecurrenceActivityId);
      ids.add(e.RecurrenceActivityId);
  }
 
  System.debug('ids = '+ids);
 
  if(ids.size()>0){
      List<Event> ev = [select id,Description from Event where id in:ids];
      System.debug('Event123 = '+ev);
      for(Event e: ev){
          e.Description='test@test.com';
      }
      
      
      update ev;//Facing internal server error here while updating the parent event record.
  }
}   

Hi,
I am using Salesforce Custom Settings for storing config details for my apex code base.
Can we make data readonly in Custom Settings objects ?

At present i see that users under a profiles which is having "Customize Application" permission enabled, can view the data and edit it in Salesforce UI. 
Is there anyway from stopping a user from editing the config details data in Custom Settings object ?

Hi Guys,

I have created a webservice in salesforce and generated WSDL file for it.And using some salesforce tools i have generated jar file and added it into my application .Now, i am facing login issue in it.

It says 

INVALID_SESSION_ID: Invalid Session ID found in SessionHeader: Illegal Session

i want to know how to saolve this issue .

Below is my code:

try {

ConnectorConfig c = new ConnectorConfig();

c.setUsername("giribhushan.svg@gmail.com");

c.setPassword("giribhushanguru123NCD8avhYG3G7Nunzy1fz0FsH");

 

SoapConnection sc = Connector.newConnection(c);

c.setSessionId(sc.getSessionHeader().getSessionId());

 

System.out.print("session id "+sc.getSessionHeader().getSessionId());

System.out.print("Institutes "+sc.getInstitutes());

} catch (ConnectionException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

 

Thank you

Can any one give sample example on schedule apex class???

How to create bulkified trigger???can anyone give me sample example

????

Object: Membership__c  ()

On Insert

  • Field Assigned Marketer (lookup to User) will be assigned this way:

o   Program__r.New_Business_Marketer__c (text) has “Marketer” added to the end. The resulting string is used to query AccountTeamMembers for the associated Account: Role = New_Business_Marketer__c + ‘ Marketer’.

 

can anyone help me on this?????

Hello guys,

I have generated wsdl from my apex class.Now i want to use wsdl  in my iphone app. how can i do this ???

 

plz help me....

how to delete all records in an custom object at once ??

can anyone help me on how to create new reports in dashboard ???

can anyone help me on how to create new reports in dashboard ???

Error: Compile Error: Initial term of field expression must be a concrete SObject: LIST<purchase_order_lines__c> at line 5 column 14

 

trigger MyFirstObjectTrigger on purchase_order_lines__c (after update) {

public purchase_order_lines__c[] pol=Trigger.new;

Integer diff=pol.received_quantity__c;

for (integer i=0 ;i<diff;i++){
Product_serial__c  obj = new Product_serial__c(product__c=pol.product__c,purchase_order_receipt__c=pol.purchase_order_receipt__c);
insert obj;
}

}

 

can anyone tell me how to resolve this error?????plz............

Compile Error: unexpected token: 'billStart' in last line ....can anyone help me ????

 

 

 public Date billStart;

  public Billing_Period__c inNewDate1;

  billStart = [Select Billing_Date__c from Billing_Period__c Where Id=:bl LIMIT 1].Billing_Date__c;

 

  billStart1 = billStart.addMonths(1);
        billStart2 = billStart.addMonths(2);
        billStart3 = billStart.addMonths(3);
        billStart4 = billStart.addMonths(4);
        billStart5 = billStart.addMonths(5);

 inNewDate1=[select Id from Billing_period__c where Billing_Date__c=billStart];

 

 

the total sum is done for html input tags...how to do the same sum using <apex:inputText /> using jquery....

can anyone help me!!!!!!!!!!!

 

$(document).ready(
        function (){
    
            $("input[id^=sum]").sum("keyup", "#totalSum");
        }
    );

can anyone help on this issue?????

 

<script>

function test()

{

 

var a=document.getElementById('{!$Component.r_3}').value;

 

}

 

</script>

 

<apex:form>

 

  <apex:inputText value="{!revenue3}" id="r_3"  />

<input value=" "  onfocus="test();" />

 

</apex:form>

can anyone give idea on  MMI Custom Links ????please

In the following code iam not able to find why the control is not executing if and else condtion when the for loop returns zero rows

 

 

 

Id a='001O0000003EcXk';
Id b='a0BO0000000EIBq';

P_L__c pl;

 for(P_L__c p:[Select Id from P_L__c Where Account__c =:a AND Billing_Period__c=:b])
        {
            if(p!=null)
{
 System.debug('&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&'+p.id);     
}
            else
System.debug('&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&error');      
        }

Can anyone tell me how to debug in eclipse IDE ???

Hi All,

I would like to know if Salesforce Employee community profile have API access to integrate with External applications.

Thank you!
how to insert multiple records using dynamic apex in salesforce

Hi,
I am trying to update parent event record after the recurring child event records are created.
So, in trigger i am fetching RecurrenceActivityId and query for the  parent event record using RecurrenceActivityId.
During updating the parent event record i am facing internal server error:
An internal server error has occurred An error has occurred while processing your request. The salesforce.com support team has been notified of the problem. If you believe you have additional information that may be of help in reproducing or correcting the error, please contact Salesforce Support. Please indicate the URL of the page you were requesting, any error id shown on this page as well as any other related information. We apologize for the inconvenience.

Below is my trigger code:
trigger DemoEvent on Event (after insert) {
  List<Event> evs = Trigger.new;
  Set<id> ids = new Set<id>();
  System.debug('evs = '+evs);
  for(Event e: evs){
      system.debug('RecurrenceActivityId= '+e.RecurrenceActivityId);
      ids.add(e.RecurrenceActivityId);
  }
 
  System.debug('ids = '+ids);
 
  if(ids.size()>0){
      List<Event> ev = [select id,Description from Event where id in:ids];
      System.debug('Event123 = '+ev);
      for(Event e: ev){
          e.Description='test@test.com';
      }
      
      
      update ev;//Facing internal server error here while updating the parent event record.
  }
}   

How can I use some of these visualforce components with json objects?

 

I perform queries through ajax here and there and I'd love to just shove those results into a pageBlock table...

 

Can't seem to figure it out...

  • December 03, 2010
  • Like
  • 0

I am working on a trigger that will create a custom object record when a product is add to the Opportunity, where the product name will be copied to the custom record. I qwould like the product name be the name of the custom record, but the system is returning the record id in the name field. Here is my code:

 

trigger newSpecSheet on OpportunityLineItem (after Insert) {
    List<Manufacturing_Design_Sheet__c> mds = new List<Manufacturing_Design_Sheet__c>();
    for (OpportunityLineItem oli: Trigger.new) {
        if(Pricebookentry.id != null) {
        mds.add(new Manufacturing_Design_Sheet__c (
            Name = oli.Pricebookentry.Product2.name,
            Opportunity_Name__c = oli.Opportunityid,
            RecordTypeId = '012500000001COp',
            Quotation_Item_Number__c = 1));
        
        }
    }
    insert mds;
} 

How do I put the name of the product in the name field on the custom record?

Thank you

Hi,

I am trying to write an update trigger for the following requirement:

 

I have a custom object purchase order lines which has the fields:Received Quantity,Purchase order Receipt(lookup) ,Product(lookup).
I have another custom object Product_Serial which has the following fields:Purchase order Receipt(lookup) ,Product(lookup).

 

Now whenever the received quantity on the purchase order line is updated,I want an  after update trigger to be fired that does:

 

*Check the count of product serial records having the product and purchase order receipt combination .
*For example, the received quantity was initially 4 and there are 4 product serial records.When the received quantity is updated to 6, the update trigger is fired
and it first  checks that i have 4 product serials for this product and  purchase_order_receipt combination.
*So i have to create 6-4 =2 product serial records  with this product and purchase_order_receipt combination.

 

 

I have tried to create the trigger for this as follows.but iam unable to get this to work.please help me!

 

 

trigger createserial on Purchase_Order_Line__c (after update)
//Trigger to get fired when a purchase order line record is updated.


{
public Purchase_order_line__c[] pol = Trigger.new;
//Create a variable reference to the object fired by the trigger.

 

Integer serialcount =[select count() from product_serial__c where product__c in
 (select product__c from purchase_order_line__c where id=:pol.id) and purchase_order_receipt__c in (select purchase_order_receipt_c from  purchase_order_line__c where id=:pol.id )];
//Get the count of product serial records for the selected purchase_order_line

 

Integer diff=pol.received_quantity__c-serialcount;

//Get the difference of records to determine if any new product serial records are to be created.

for (integer i=0 ;i<diff;i++){


Product_serial__c  obj = new Product_serial__c(
product__c=pol.product__c,
purchase_order_receipt__c=pol.purchase_order_receipt__c);
//create new product serial records


insert obj;
//insert is placed in loop so that for each iteration the record is inserted.
}

 

}

can anyone help on this issue?????

 

<script>

function test()

{

 

var a=document.getElementById('{!$Component.r_3}').value;

 

}

 

</script>

 

<apex:form>

 

  <apex:inputText value="{!revenue3}" id="r_3"  />

<input value=" "  onfocus="test();" />

 

</apex:form>

In the following code iam not able to find why the control is not executing if and else condtion when the for loop returns zero rows

 

 

 

Id a='001O0000003EcXk';
Id b='a0BO0000000EIBq';

P_L__c pl;

 for(P_L__c p:[Select Id from P_L__c Where Account__c =:a AND Billing_Period__c=:b])
        {
            if(p!=null)
{
 System.debug('&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&'+p.id);     
}
            else
System.debug('&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&error');      
        }

how to display names of an custom object according to their according to their date creation

 

ex:

var=[select name from billingperiod__c order by ??? ];

 

i want to display names on the order of creation

unexpexted token error is shown for the following code:

My id comes dynamically how can i write the query.....plz help

 

public class proitem{

    public String getPro() {
       

        String id = 'a0890000000BLihAAG';
       it=[select name from item__c where product__c =id];
        
       return it;
    }

}

I have created a dependent objects  drop down lists of type product and item in the visualforce page .
I need to create a command button in which the action is to generate 5 rows in the visualforce page , each row contains same  dependent object drop down list which i have created earlier .

I have generated rows using repeater controller and wrapper class but, the problem is that only last row drop down list works remaining rows remain inactive .
Can any one help me on this issue???

Please see the following code:

 

apex class:

 

public class dependentObjects{

String product;

String item;
String name;
String accname;
String divname;
String startperiod;


   public List<WrapperQueAns> lstQueAns = new List<WrapperQueAns>{};

 public List<WrapperQueAns> propLstQuesAns { get { return lstQueAns; } set { lstQueAns = value; } }


public String getProduct()
{
return this.product;
}
public void setProduct(String s)
{
this.product=s;
}
public String getAccname()
{
return this.accname;
}
public void setAccname(String s)
{
this.accname=s;
}
public String getItem()
{
return this.item;
}
public void setItem(String s)
{
this.item=s;
}
public String getDivname()
{
return this.divname;
}
public void setDivname(String s)
{
this.divname=s;
}

public String getName()
{
return this.name;
}
public void setName(String s)
{
this.name=product;
}

public String getStartperiod()
{
return this.startperiod;
}
public void setStartperiod(String s)
{
this.startperiod=s;
}


 

public List<SelectOption> getProducts(){

List<SelectOption> optionList=new List<SelectOption>();
optionList.add(new SelectOption('','-NONE-'));

for(product__c bp:[select name from product__c order by Name])
{
optionList.add(new SelectOption(bp.id,bp.name));
}
return optionList;
}
public List<SelectOption> getItems() {
      List<SelectOption> optionList = new List<SelectOption>();
     
       optionList.add(new SelectOption('', '- None -'));

   
      if(product!= NULL) {

      
        for (item__c bi : [select name from item__c bi where bi.product__c = :product]){
          optionList.add(new SelectOption(bi.id,bi.name));
        }
      }
      return optionList;
    }
   
    public List<SelectOption> getAccountname()
    {
     List<SelectOption> optionList = new List<SelectOption>();
     optionList.add(new SelectOption('', '- None -'));
     for(Account ac:[select name from Account where type='Client'])
{
optionList.add(new SelectOption(ac.id,ac.name));
}
return optionList;
   
    }
   
    public List<SelectOption> getDivnames(){

List<SelectOption> optionList=new List<SelectOption>();
optionList.add(new SelectOption('','-NONE-'));

for(Division__c di:[select name from Division__c ])
{
optionList.add(new SelectOption(di.id,di.name));
}
return optionList;
}

    public List<SelectOption> getStartp(){

List<SelectOption> optionList=new List<SelectOption>();
optionList.add(new SelectOption('','-NONE-'));

for(Billing_period__c sp:[select name from Billing_period__c ])
{
optionList.add(new SelectOption(sp.id,sp.name));
}
return optionList;
}

public void DynamicRow(){

for(Integer i=0;i<5;i++){

WrapperQueAns wqa = new WrapperQueAns();

wqa.propAns    = '';
 
lstQueAns.add(wqa);

 }

}
  public class WrapperQueAns{public String propAns   { get; set; } }//End Class WrapperQueAns
 
}

 

visualforce page:


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

<p>
<table>
<tr>
<td>

Account:
<apex:selectList value="{!accname}" size="1" id="accname">
            <apex:selectOptions value="{!Accountname}"/>  
          </apex:selectList>

</td>
<td>
Division:
<apex:selectList value="{!divname}" size="1" id="division">
            <apex:selectOptions value="{!divnames}"/>
          </apex:selectList>

</td>
<td>
Start Period:
<apex:selectList value="{!startperiod}" size="1" id="startp">
            <apex:selectOptions value="{!startp}"/>
            
          </apex:selectList>

</td>
</tr>
<tr>
<td>
product
<apex:selectList value="{!product}" size="1" id="category2">
            <apex:selectOptions value="{!products}"/>
            <apex:actionSupport event="onchange" rerender="features2,test,r"/>
          </apex:selectList>
          </td>
          <td>
Item     
     <apex:selectList value="{!item}" size="1" id="features2" disabled="{!ISNULL(product)}">
         <apex:selectOptions value="{!items}"/>
     </apex:selectList>
     <apex:inputText value="{!name}" id="test"/>
</td>

<td>
              Sep10  
                <input name="sum" value="{!name}" size="5" id="r" type="text"/>
               
</td>

<td>                
           Oct10     
                <input name="sum" value="2" size="5" type="text"/>
                </td>
              
                <td>
                  Nov10
                <input name="sum" value="1" size="5" type="text"/>
                </td>
              
                <td>
                  Dec10
                <input name="sum" value="0" size="5" type="text"/>
                </td>
                
                <td>
                Total:
                &nbsp;&nbsp;
                
                
                <input name="totalSum" id="totalSum" value="6" size="2" readonly="readonly" type="text"/>
               </td>
              </tr>
              </table>  
              </p>
                
                  
            
</apex:form>

<apex:outputPanel id="refreshdata">
<apex:repeat value="{!propLstQuesAns}" var="varLQA" id="textquesrp">
<apex:form >

 <p>

product
<apex:selectList value="{!product}" size="1" id="category2">
            <apex:selectOptions value="{!products}"/>
            <apex:actionSupport event="onchange" rerender="features2,test"/>
          </apex:selectList>
          
Item     
     <apex:selectList value="{!item}" size="1" id="features2" disabled="{!ISNULL(product)}">
         <apex:selectOptions value="{!items}"/>
     </apex:selectList>
     <apex:inputText value="{!name}" id="test"/>

 </p>

</apex:form>
</apex:repeat>
</apex:outputPanel>
<apex:form >
<apex:commandButton action="{!DynamicRow}" reRender="refreshdata" value="ADD ROW"/>
</apex:form>

</apex:page>

How to i populate custom picklist in triggers

Hi there,

Great app, but have geo-coded about 1/3 of our orgs accounts and I think I have found a bug. Am getting an error message when ever going to the geocode tab.

Invalid double:

An unexpected error has occurred. Your solution provider has been notified. (FN)


This is preventing any further accounts to be located, would be great to know what is causing this and how to resolve it to get the rest of the accounts located.

 

Could the creator (or someone) of this app let us know if this is happening due to a bug in the code, or if this is an issue with the format of the address values.

If it is a bug I hope that this can be resolved soon.

If it is a problem with format of the data, could we please know what we need to look for in the data to fix? Is it an issue that there could be a bad character in the address data somewhere? How can I tell what the next account record is that the Geocode tab looks at (what order does it run though the records)? So I can check the data an fix it, if this is the problem.

This is a great app and really need all account records mapped for it to be useful, we only have a partial set of records that are mapped due to this problem

 

I have tried this on different browsers and it seems it is happening to other orgs possibly as well (as this has been commented in the comments section of the app) - just found this discussion forum

  • August 19, 2010
  • Like
  • 0