• damo2929
  • NEWBIE
  • 0 Points
  • Member since 2010

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 3
    Replies

I have a trigger that am trying to build a name from the names of two other objects that are linked by this object.

below is my code  

 

trigger trgAssetsProducts on Asset_Products__c (before insert) {

		for (Asset_Products__c c : trigger.new)
		{
			List<Asset> Assets = 
						[ 	SELECT  Id, Name
  							From Asset
  							WHERE Asset.Id in c.Asset__c
  						
						];
						
		
			List<Product2> Products = 
						[ 	SELECT  id, Name
  							From Product2
  							WHERE product2.Id = c.Product__c
  							
						];
						 
		Trigger.new[c].Name = string.valueof(Assets[c].Name) + '_' +string.valueof(Products[c].Name);	
		
		
		}
				

}

 but i get the following error

 

Description Resource Path Location Type
Save error: unexpected token: 'c.Asset__c' trgAssetsProducts.trigger /Damien's Toybox/src/triggers line 8 Force.com save problem

 

What am I doing wrong here ?

I am trying to write a formula that check the current stage and adds the number of days better two dates to another int number.

 

here is my formual what am trying to do

 

IF( ISPICKVAL( StageName , '0 Identify') ,  ROUND((NOW() - DQ_Days_Since_Stage_Change__c) +DQ_Duration_Stage_0__c  , 0),  DQ_Duration_Stage_0__c )

 

but keep getting the following error Error: Incorrect parameter for function 'ROUND()'. Expected Number, received DateTime

any ides of how to fix this as all the examples use this approch and work.

 

Hi all am wanting to do some math to generate times an opportunity has been in each state, fo this we have opportunity field tracking enabled and tracked.

 

 

now what I have been asked to develop is a system which now read the field history and back fill custom fields in the main opportunity for how long the opportunity is in each stage.

 

 

now I can generate a report on the reports engine for this table but am not able to see the object. anybody know how to access this information via apex ?

 

the fields am after from the table are

edit date

old value

new value

field event

stage duration

parent ID

 

ordered by edit date if possible.

 

so that I can get them into an array so that I can itterate though them to populate fields with the time at each stage.

Hi all

 

I have a requirement in that I need to be able to allocate a custom object  to a member of a profile that is active on the system.

 

 

is there anyway of obtaing the list of people dynamically when then open a visual force page and then building a pick list in that page ?

 

 

Hi all I have a custom object called bids which is used for tendering. I need to be find a way of cloning that allow me to make a deep clone of the object but just for the user to change two mandatory field before it is saved to the database. IE am trying to prevent the user cloning a record that is has a mandatory value of closed being cloned and saved, the user needs to be forced to place it in any other state before it's commited. the second field is the bid closing date which also needs to be forced to a value. any ideas on how I can go about creating the needed clone -> update -> commit routine ?

I have written a work flow that is detecting when the account name changes which is trying to update a custom field "account know as" but every time I run the rule I get an error.

 

Error: Invalid Data.
Review all error messages below to correct your data.
Error: An account with this name already exists.
but it does not already exist as am running in an empty sandbox.
Rule Criteria: formula is
 ISCHANGED( Name )
if I set it to a static critria the rule works fine
any ideas why this fails?

I have a trigger that am trying to build a name from the names of two other objects that are linked by this object.

below is my code  

 

trigger trgAssetsProducts on Asset_Products__c (before insert) {

		for (Asset_Products__c c : trigger.new)
		{
			List<Asset> Assets = 
						[ 	SELECT  Id, Name
  							From Asset
  							WHERE Asset.Id in c.Asset__c
  						
						];
						
		
			List<Product2> Products = 
						[ 	SELECT  id, Name
  							From Product2
  							WHERE product2.Id = c.Product__c
  							
						];
						 
		Trigger.new[c].Name = string.valueof(Assets[c].Name) + '_' +string.valueof(Products[c].Name);	
		
		
		}
				

}

 but i get the following error

 

Description Resource Path Location Type
Save error: unexpected token: 'c.Asset__c' trgAssetsProducts.trigger /Damien's Toybox/src/triggers line 8 Force.com save problem

 

What am I doing wrong here ?

I am trying to write a formula that check the current stage and adds the number of days better two dates to another int number.

 

here is my formual what am trying to do

 

IF( ISPICKVAL( StageName , '0 Identify') ,  ROUND((NOW() - DQ_Days_Since_Stage_Change__c) +DQ_Duration_Stage_0__c  , 0),  DQ_Duration_Stage_0__c )

 

but keep getting the following error Error: Incorrect parameter for function 'ROUND()'. Expected Number, received DateTime

any ides of how to fix this as all the examples use this approch and work.

Hi all I have a custom object called bids which is used for tendering. I need to be find a way of cloning that allow me to make a deep clone of the object but just for the user to change two mandatory field before it is saved to the database. IE am trying to prevent the user cloning a record that is has a mandatory value of closed being cloned and saved, the user needs to be forced to place it in any other state before it's commited. the second field is the bid closing date which also needs to be forced to a value. any ideas on how I can go about creating the needed clone -> update -> commit routine ?