Skip to main content
added 2 characters in body
Source Link
Peter Knolle
  • 29.2k
  • 12
  • 104
  • 164

Thank you for taking the time to look into my question, this is my first Apex/Salesforce project, I am familiar with Java and javascript.

I have been tasked to creating a new Object called 'Service Agreement' from the Opportunity. I just need to automate the creation of the object and fill in certain fields that I get from the Opportunity and related Quote, I also need to do some calculations and such. It seems to me that making a class is the best solution and calling the method within the class from a button in the Opportunity. So the button I assume should use Javascript.

My questions are as follows:

  1. Is this the best approach? ( I could use a db trigger but if the object is created outside of the Opportunity there would be errors)
  2. If I want to do alert('var') in javascript and also return a boolean of true or false is it possible? (I want to customize the visual errors this way for the user)

I will be using

CurrentPageId = ApexPages.CurrentPage().getParameters().get('id'); 

To get the id from the opportunity and then use SOQL to get the necessary field info.

Any opinions would be greatly appreciated, I have been reading into this, and becoming more and more confused

Thank you for taking the time to look into my question, this is my first Apex/Salesforce project, I am familiar with Java and javascript.

I have been tasked to creating a new Object called 'Service Agreement' from the Opportunity. I just need to automate the creation of the object and fill in certain fields that I get from the Opportunity and related Quote, I also need to do some calculations and such. It seems to me that making a class is the best solution and calling the method within the class from a button in the Opportunity. So the button I assume should use Javascript.

My questions are as follows:

  1. Is this the best approach? ( I could use a db trigger but if the object is created outside of the Opportunity there would be errors)
  2. If I want to do alert('var') in javascript and also return a boolean of true or false is it possible? (I want to customize the visual errors this way for the user)

I will be using

CurrentPageId = ApexPages.CurrentPage().getParameters().get('id'); 

To get the id from the opportunity and then use SOQL to get the necessary field info.

Any opinions would be greatly appreciated, I have been reading into this, and becoming more and more confused

Thank you for taking the time to look into my question, this is my first Apex/Salesforce project, I am familiar with Java and javascript.

I have been tasked to creating a new Object called 'Service Agreement' from the Opportunity. I just need to automate the creation of the object and fill in certain fields that I get from the Opportunity and related Quote, I also need to do some calculations and such. It seems to me that making a class is the best solution and calling the method within the class from a button in the Opportunity. So the button I assume should use Javascript.

My questions are as follows:

  1. Is this the best approach? ( I could use a db trigger but if the object is created outside of the Opportunity there would be errors)
  2. If I want to do alert('var') in javascript and also return a boolean of true or false is it possible? (I want to customize the visual errors this way for the user)

I will be using

CurrentPageId = ApexPages.CurrentPage().getParameters().get('id'); 

To get the id from the opportunity and then use SOQL to get the necessary field info.

Any opinions would be greatly appreciated, I have been reading into this, and becoming more and more confused

Source Link
jnoel10
  • 1k
  • 1
  • 11
  • 25

Is using a class a good option for creating a new Object and how could I send an error string to javascript?

Thank you for taking the time to look into my question, this is my first Apex/Salesforce project, I am familiar with Java and javascript.

I have been tasked to creating a new Object called 'Service Agreement' from the Opportunity. I just need to automate the creation of the object and fill in certain fields that I get from the Opportunity and related Quote, I also need to do some calculations and such. It seems to me that making a class is the best solution and calling the method within the class from a button in the Opportunity. So the button I assume should use Javascript.

My questions are as follows:

  1. Is this the best approach? ( I could use a db trigger but if the object is created outside of the Opportunity there would be errors)
  2. If I want to do alert('var') in javascript and also return a boolean of true or false is it possible? (I want to customize the visual errors this way for the user)

I will be using

CurrentPageId = ApexPages.CurrentPage().getParameters().get('id'); 

To get the id from the opportunity and then use SOQL to get the necessary field info.

Any opinions would be greatly appreciated, I have been reading into this, and becoming more and more confused