• Hugo_B
  • NEWBIE
  • 10 Points
  • Member since 2009

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 13
    Questions
  • 12
    Replies
I have 2 classes containing various methods.

In the first class I want to call the class "addInvoice()"

The addInvoice class should return the invoiceID

I would like to take the returned invoiceID and assign it to a variable to be used elsewhere in the class

Here is the call in the first class:
 
InvoiceAdd invoice = new InvoiceAdd();
           String invID = invoice.invID;

This is the method in the second class
Public String InvoiceAdd(String projID, String oppID) {
    system.debug('1');
    Invoice__c inv = new Invoice__c(Project__c = projid);
       system.debug('2');
        insert inv;
        String invID = inv.id;
        system.debug('3');
        system.debug('oppID ' + oppID);
        system.debug('invID ' + invID);
 return invID;
}
 
I just keep getting errors such as:  Error: Compile Error: Invalid type: InvoiceAdd at line 65 column 38

Any help?
 
  • August 03, 2015
  • Like
  • 0
I have a trigger on a custom object (Time_Card_Entry__c) that looks at a CONTRACT lookup field on the object.  If the Contract lookup is not empty, it populates the set with the contract - then uses "MAP" to pull data about the contract which I use later in the trigger. 

My issue is I want to check to see if the Contract lookup is null, then populate it with a contract record that is based on a SOQL query - but I can't seem to manage to add the SOQL query results to the SET with out getting an error.  Here is what I have:

if(Trigger.isInsert||Trigger.isUpdate) {          
                Set<Id> contractIds = new Set<Id>();
                     // If a Contract exists on the time entry record, popuate the contractID set with the contract  
                     for (Time_Card_Entry__c te : Trigger.new) {
                            if (te.Contract__c != null) {
                                    contractIds.add(te.Contract__c);
                    }else
                         **** HERE IS WHERE I WANT TO ADD TO THE SET A CONTRACT ID BASED UPON A SOQL QUERY E.G BUT THIS IS NOT WORKING - TRIED SEVERAL WAYS - THIS IS ONLY AN EXAMPLE

                         contractids.add(Select ID from CONTRACT where account = "xxxxx" and contract = 'active' Limit 1)

                    }
                }
                

            // Create Map of Contract to hold fields from Contract  
               Map<Id, Contract> contractEntries = new Map<Id, Contract>(
                    [select CMRate__c, ConsultingRate__c, Data_ManagementRate__c, PMRate__c, SupportRate__c, GrpTrainRateFL__c,
                    GrpTrainRateHd__c, GrTrainRateHR__c, OneTrainRate__c, IT_SupportRate__c, Account_Name__c from Contract where id in :contractIds]
                );
    

The above works provided the Contract lookup field is populated, but I can't get the code to look up a contract and populate the SET if there is no contract.

Any help greatly appreciated!

Hugo
  • January 12, 2015
  • Like
  • 0

I would like to calculate the time between 2 datetime fields to provide me with a result in hours.  The dates could be more than a day apart (ie. maybe the difference is 103 hours)

 

I would like to put it in a trigger that updates a field on Cases.

 

Any help appreciated.

I have a trigger on a custom object called "Time_Entry__c" that; when a record is created and *IF* there is a related contract associated with the Time Entry, it looks up the rates set-out on that contract record and uses the rates listed in the parent (Contract) record.

 

  Rate_1__c  (currency field)

  Rate_2__c  (currency field)

 

The look-up field on the Time_Entry__C object is called Contract__c

 

The related object is the Contract object in SF:  Contract__r

 

Contract__r has the two currency fields.

 

    CustomRate1__c

    CustomRate2__c

 

 

What I need is to have my trigger, look up the parent contract (if there is a value in Contract__c). and pull the two rates CustomRate1__c and CustomRate2__c and populate them into the Time Entry records Rate_1__c and Rate_2__c respectively.

 

Can anyone help with code for this trigger???

 

 

  • January 02, 2012
  • Like
  • 0

I have a custom object "Time_Entry__C" that has a look-up field called "Employee__C" which holds the ID from an Employee object

  - The employee object has ID, Firstname__C; Lastname__C fields.

 

I want to populate the Employee1__c field (in the Time_Entry__C object) with the ID from the Employee object (SFDC_Employee__c) BASED upon the current user (if found).

 

For example.  The current user = "John Doe"  When he creates a record in the Time_Entry__c object, I want a "before insert"  trigger to find the ID in the SFDC_Employee__c object  where SFDC_Employee__c.firstname = UserInfo.firstname and SFDC_Employee__c.lastname = Userinfo.Lastname then plop that Employee ID into the Employee1__c  lookup field on the Time_Entry__c object.

 

Any help?

  • October 31, 2011
  • Like
  • 0

I have a custom object that uses workflow and an approval process.  When the record is first created I set a field called Status to "Initiating".  I would like to send a reminder to the owner of the record every morning as long as the status stays in "Initiatiing".  If the status is any other value, then the notifications should stop.

 

I tried creating a time-related workflow that says after the record is created or edited, and if the status is still "Initiating" send out an email.  That works only once.  But does not work for day 2 (for example).  I then tried changing the status in workflow using a field update, but that doesn't work either.

 

Any ideas?

  • October 11, 2011
  • Like
  • 0

I need to loop through one (and more) related lists of a custom object.  The related lists are also custom objects.

 

Any help on the basic code structure?  How do I identify the records only associated with the current object, then loop through them and, for example, assign records of that related list to a variable, which I in turn update the parent object.   In essence creating a trigger "roll-up" function to a custom object and its related list records.

  • October 11, 2011
  • Like
  • 0

This may seem a simple question but I would like to make a custom page layout on a custom object that has more than two columns and would like to have the fields show up in edit and view mode.

 

I assume this is done with visual force pages but are there any examples I can use to get me started?

  • October 06, 2011
  • Like
  • 0

I can't find a good code example that will allow me to have a VF page / site that let's a user (Customer Portal User) upload a document to a folder in the document object.

 

Any help greatly appreciated!!

  • August 29, 2010
  • Like
  • 0

I am losing my mind trying to find the answer to this question.

 

I want to put a link on my customer portal page that opens a new page that allows a customer to upload a document - and store that document in the DOCUMENT object (document tab), in a specific folder.

 

I can't find anything.  I found one example, but when I entered it, it seems like only partial code.

 

Can anyone help?

  • August 29, 2010
  • Like
  • 0

Is there currently a mechanism to keep end-users informed of changes that System Admin's make to the Salesforce org?  This could be from field additions / changes to new workflow or validation rules?

 

Ideally I would like something that could be on the home page when users log in - so they can see recent / all changes.

 

Any help much appreciated!

 

Hugo

I have created a trigger which performs a calculation on a custom object "after insert, update or delete".

 

I have a Sandbox (whoopee); I can deploy the trigger to the sandbox, but I have no clue how to TEST and Deploy to production.

 

 

Can anyone point me in the right direction on what to read?  I have looked at the APEX Code developer guide, but I don't understand how to run a test and deploy the trigger.

 

I could be just plain stupid, but I would have hoped to find some "here are the steps to deploy a trigger from eclipse" type instructions but I can't find any.

 

PS - if I am just plain stupid, then I may be doomed ;)

  • December 29, 2010
  • Like
  • 0

I have three custom objects that are related as follows:

 

Project

            Shipment

                             Batches

 

Each has a one to many relationship to the one below (1 project can have many shipments; each shipment can have many batches)

 

I want to display a total value in the Shipment object for the batches - for example, there may be 10 batch records related to one shipment and I want to sum the total value of all the batches in the shipment level.

 

I cannot create a master detail relationship between Shipment and Batches; because Shipment is already a "Detail" side of a relationship with the Project - so therefore, as I understand it, I cannot create a roll-up to use the Sum feature).

 

I tried creating a look-up on the Shipment table to the Batch Table to enter a custom formula to the Batch_Value field, but it does not give me a total (it just gives me 0 as the value).

 

Can anyone help me either with this formula or how to get a total of all related batches into my shipment table?

 

Thanks!!!

 

Hugo_B

 

  • September 11, 2009
  • Like
  • 0
I have 2 classes containing various methods.

In the first class I want to call the class "addInvoice()"

The addInvoice class should return the invoiceID

I would like to take the returned invoiceID and assign it to a variable to be used elsewhere in the class

Here is the call in the first class:
 
InvoiceAdd invoice = new InvoiceAdd();
           String invID = invoice.invID;

This is the method in the second class
Public String InvoiceAdd(String projID, String oppID) {
    system.debug('1');
    Invoice__c inv = new Invoice__c(Project__c = projid);
       system.debug('2');
        insert inv;
        String invID = inv.id;
        system.debug('3');
        system.debug('oppID ' + oppID);
        system.debug('invID ' + invID);
 return invID;
}
 
I just keep getting errors such as:  Error: Compile Error: Invalid type: InvoiceAdd at line 65 column 38

Any help?
 
  • August 03, 2015
  • Like
  • 0

I have a trigger on a custom object called "Time_Entry__c" that; when a record is created and *IF* there is a related contract associated with the Time Entry, it looks up the rates set-out on that contract record and uses the rates listed in the parent (Contract) record.

 

  Rate_1__c  (currency field)

  Rate_2__c  (currency field)

 

The look-up field on the Time_Entry__C object is called Contract__c

 

The related object is the Contract object in SF:  Contract__r

 

Contract__r has the two currency fields.

 

    CustomRate1__c

    CustomRate2__c

 

 

What I need is to have my trigger, look up the parent contract (if there is a value in Contract__c). and pull the two rates CustomRate1__c and CustomRate2__c and populate them into the Time Entry records Rate_1__c and Rate_2__c respectively.

 

Can anyone help with code for this trigger???

 

 

  • January 02, 2012
  • Like
  • 0

Hi there,

Can anybody help me in impoerting a custom case trigger from sandbox to production.

  • October 11, 2011
  • Like
  • 0

How do I import profiles of the Sandbox for a production environment?

 

Thx for the replies

I need to loop through one (and more) related lists of a custom object.  The related lists are also custom objects.

 

Any help on the basic code structure?  How do I identify the records only associated with the current object, then loop through them and, for example, assign records of that related list to a variable, which I in turn update the parent object.   In essence creating a trigger "roll-up" function to a custom object and its related list records.

  • October 11, 2011
  • Like
  • 0

This may seem a simple question but I would like to make a custom page layout on a custom object that has more than two columns and would like to have the fields show up in edit and view mode.

 

I assume this is done with visual force pages but are there any examples I can use to get me started?

  • October 06, 2011
  • Like
  • 0

I am losing my mind trying to find the answer to this question.

 

I want to put a link on my customer portal page that opens a new page that allows a customer to upload a document - and store that document in the DOCUMENT object (document tab), in a specific folder.

 

I can't find anything.  I found one example, but when I entered it, it seems like only partial code.

 

Can anyone help?

  • August 29, 2010
  • Like
  • 0

I have three custom objects that are related as follows:

 

Project

            Shipment

                             Batches

 

Each has a one to many relationship to the one below (1 project can have many shipments; each shipment can have many batches)

 

I want to display a total value in the Shipment object for the batches - for example, there may be 10 batch records related to one shipment and I want to sum the total value of all the batches in the shipment level.

 

I cannot create a master detail relationship between Shipment and Batches; because Shipment is already a "Detail" side of a relationship with the Project - so therefore, as I understand it, I cannot create a roll-up to use the Sum feature).

 

I tried creating a look-up on the Shipment table to the Batch Table to enter a custom formula to the Batch_Value field, but it does not give me a total (it just gives me 0 as the value).

 

Can anyone help me either with this formula or how to get a total of all related batches into my shipment table?

 

Thanks!!!

 

Hugo_B

 

  • September 11, 2009
  • Like
  • 0