Skip to main content
added 388 characters in body
Source Link
Keith C
  • 137.3k
  • 29
  • 218
  • 458

Here is one approach...

Store the set of questions in a normal custom object that you can then relate to the Account or store them in a list custom setting.

If there is a maximum number of questions of say 10, add 10 text custom fields to Task (Activity) to hold copies of the relevant questions (that are set read-only in the Task page layout) and 10 text custom fields for the users to enter their answers (that are left editable). Note that this approach does not allow the answers to be of various types e.g. checkbox, date etc and unless the number of questions is always fixed you can't make the answers required.

(Alternatively you could just format the Tasks's Description field to list the questions and include prompts for the answers so that the user can answer by editing the Descriptions.)

If you are creating the Task from Apex code, you populate the questions as you create the Task. If users are creating the Task through the normal UI "new" button, then you add a trigger that uses the Tasks's WhatId and/or WhoId to find the object the Task is related to and then populate the relevant questions in the trigger.

Update - Using List Custom Settings

Create a custom setting using “New” of "Setting Type" of "List" and "Visibility" of "Public" called Question"Question" that has a 255 character text field called Text"Text". You can then “Manage” that list custom setting and add your questions to it; you will also have to give each question a unique Name"Name". You can use “Create New View” to conveniently see all the entries. 

Then in your code you can get a list of all the questions by invoking Question__c.getAll(and therefore can access the Text__c fields) using:

Question__c[] questions = Question__c.getAll();

To control ordering, you could add a numeric "Sequence" field that you set via "Manage" to 1, 2, 3 etc. and in that case it is better to use SOQL to access the questions so you can get them in the correct order e.g.:

Question__c[] questions = [select Text__c from Question__c order by Sequence__c];

Please Google for further examples and information on this.

Here is one approach...

Store the set of questions in a normal custom object that you can then relate to the Account or store them in a list custom setting.

If there is a maximum number of questions of say 10, add 10 text custom fields to Task (Activity) to hold copies of the relevant questions (that are set read-only in the Task page layout) and 10 text custom fields for the users to enter their answers (that are left editable). Note that this approach does not allow the answers to be of various types e.g. checkbox, date etc and unless the number of questions is always fixed you can't make the answers required.

(Alternatively you could just format the Tasks's Description field to list the questions and include prompts for the answers so that the user can answer by editing the Descriptions.)

If you are creating the Task from Apex code, you populate the questions as you create the Task. If users are creating the Task through the normal UI "new" button, then you add a trigger that uses the Tasks's WhatId and/or WhoId to find the object the Task is related to and then populate the relevant questions in the trigger.

Update - Using List Custom Settings

Create a custom setting using “New” of "Setting Type" of "List" and "Visibility" of "Public" called Question that has a 255 character text field called Text. You can then “Manage” that list custom setting and add your questions to it; you will also have to give each question a unique Name. You can use “Create New View” to conveniently see all the entries. Then in your code you can get a list of all the questions by invoking Question__c.getAll(). Please Google for further examples and information on this.

Here is one approach...

Store the set of questions in a normal custom object that you can then relate to the Account or store them in a list custom setting.

If there is a maximum number of questions of say 10, add 10 text custom fields to Task (Activity) to hold copies of the relevant questions (that are set read-only in the Task page layout) and 10 text custom fields for the users to enter their answers (that are left editable). Note that this approach does not allow the answers to be of various types e.g. checkbox, date etc and unless the number of questions is always fixed you can't make the answers required.

(Alternatively you could just format the Tasks's Description field to list the questions and include prompts for the answers so that the user can answer by editing the Descriptions.)

If you are creating the Task from Apex code, you populate the questions as you create the Task. If users are creating the Task through the normal UI "new" button, then you add a trigger that uses the Tasks's WhatId and/or WhoId to find the object the Task is related to and then populate the relevant questions in the trigger.

Update - Using List Custom Settings

Create a custom setting using “New” of "Setting Type" of "List" and "Visibility" of "Public" called "Question" that has a 255 character text field called "Text". You can then “Manage” that list custom setting and add your questions to it; you will also have to give each question a unique "Name". You can use “Create New View” to conveniently see all the entries. 

Then in your code you can get a list of all the questions (and therefore can access the Text__c fields) using:

Question__c[] questions = Question__c.getAll();

To control ordering, you could add a numeric "Sequence" field that you set via "Manage" to 1, 2, 3 etc. and in that case it is better to use SOQL to access the questions so you can get them in the correct order e.g.:

Question__c[] questions = [select Text__c from Question__c order by Sequence__c];

Please Google for further examples and information.

added 556 characters in body
Source Link
Keith C
  • 137.3k
  • 29
  • 218
  • 458

Here is one approach...

Store the set of questions in a normal custom object that you can then relate to the Account or store them in a list custom setting.

If there is a maximum number of questions of say 10, add 10 text custom fields to Task (Activity) to hold copies of the relevant questions (that are set read-only in the Task page layout) and 10 text custom fields for the users to enter their answers (that are left editable). Note that this approach does not allow the answers to be of various types e.g. checkbox, date etc and unless the number of questions is always fixed you can't make the answers required.

(Alternatively you could just format the Tasks's Description field to list the questions and include prompts for the answers so that the user can answer by editing the Descriptions.)

If you are creating the Task from Apex code, you populate the questions as you create the Task. If users are creating the Task through the normal UI "new" button, then you add a trigger that uses the Tasks's WhatId and/or WhoId to find the object the Task is related to and then populate the relevant questions in the trigger.

Update - Using List Custom Settings

Create a custom setting using “New” of "Setting Type" of "List" and "Visibility" of "Public" called Question that has a 255 character text field called Text. You can then “Manage” that list custom setting and add your questions to it; you will also have to give each question a unique Name. You can use “Create New View” to conveniently see all the entries. Then in your code you can get a list of all the questions by invoking Question__c.getAll(). Please Google for further examples and information on this.

Here is one approach...

Store the set of questions in a normal custom object that you can then relate to the Account or store them in a list custom setting.

If there is a maximum number of questions of say 10, add 10 text custom fields to Task (Activity) to hold copies of the relevant questions (that are set read-only in the Task page layout) and 10 text custom fields for the users to enter their answers (that are left editable). Note that this approach does not allow the answers to be of various types e.g. checkbox, date etc and unless the number of questions is always fixed you can't make the answers required.

(Alternatively you could just format the Tasks's Description field to list the questions and include prompts for the answers so that the user can answer by editing the Descriptions.)

If you are creating the Task from Apex code, you populate the questions as you create the Task. If users are creating the Task through the normal UI "new" button, then you add a trigger that uses the Tasks's WhatId and/or WhoId to find the object the Task is related to and then populate the relevant questions in the trigger.

Here is one approach...

Store the set of questions in a normal custom object that you can then relate to the Account or store them in a list custom setting.

If there is a maximum number of questions of say 10, add 10 text custom fields to Task (Activity) to hold copies of the relevant questions (that are set read-only in the Task page layout) and 10 text custom fields for the users to enter their answers (that are left editable). Note that this approach does not allow the answers to be of various types e.g. checkbox, date etc and unless the number of questions is always fixed you can't make the answers required.

(Alternatively you could just format the Tasks's Description field to list the questions and include prompts for the answers so that the user can answer by editing the Descriptions.)

If you are creating the Task from Apex code, you populate the questions as you create the Task. If users are creating the Task through the normal UI "new" button, then you add a trigger that uses the Tasks's WhatId and/or WhoId to find the object the Task is related to and then populate the relevant questions in the trigger.

Update - Using List Custom Settings

Create a custom setting using “New” of "Setting Type" of "List" and "Visibility" of "Public" called Question that has a 255 character text field called Text. You can then “Manage” that list custom setting and add your questions to it; you will also have to give each question a unique Name. You can use “Create New View” to conveniently see all the entries. Then in your code you can get a list of all the questions by invoking Question__c.getAll(). Please Google for further examples and information on this.

added 9 characters in body
Source Link
Keith C
  • 137.3k
  • 29
  • 218
  • 458

Here is one approach...

Store the set of questions in a normal custom object that you can then relate to the Account or store them in a list custom setting.

If there is a maximum number of questions of say 10, add 10 text custom fields to Task (Activity) to hold copies of the relevant questions (that are set read-only in the Task page layout) and 10 text custom fields for the users to enter their answers (that are left editable). Note that this approach does not allow the answers to be of various types e.g. checkbox, date etc and unless the number of questions is always fixed you can't make the answers required.

(Alternatively you could just format the Tasks's Description field to list the questions and include prompts for the answers so that the user can answer by editing the Descriptions.)

If you are creating the Task from Apex code, you populate the questions as you create the Task. If users are creating the Task through the normal UI "new" button, then you add a trigger that uses the Tasks's WhatId and/or WhoId to find the object the Task is related to and then populate the relevant questions in the trigger.

Here is one approach...

Store the set of questions in a normal custom object that you can then relate to the Account or store them in a list custom setting.

If there is a maximum number of questions of say 10, add 10 text custom fields to Task (Activity) to hold copies of the relevant questions (that are set read-only in the Task page layout) and 10 text custom fields for the users to enter their answers (that are left editable). Note that this approach does not allow the answers to be of various types e.g. checkbox, date etc and unless the number of questions is always fixed you can't make the answers required.

(Alternatively you could just format the Tasks's Description field to list the questions and include prompts for the answers so that the user can answer by editing the Descriptions.)

If you are creating the Task from Apex code, you populate the questions as you create the Task. If users are creating the Task through the normal UI "new" button, then you add a trigger that uses the Tasks's WhatId and/or WhoId to find the object the Task is related to and then populate the questions in the trigger.

Here is one approach...

Store the set of questions in a normal custom object that you can then relate to the Account or store them in a list custom setting.

If there is a maximum number of questions of say 10, add 10 text custom fields to Task (Activity) to hold copies of the relevant questions (that are set read-only in the Task page layout) and 10 text custom fields for the users to enter their answers (that are left editable). Note that this approach does not allow the answers to be of various types e.g. checkbox, date etc and unless the number of questions is always fixed you can't make the answers required.

(Alternatively you could just format the Tasks's Description field to list the questions and include prompts for the answers so that the user can answer by editing the Descriptions.)

If you are creating the Task from Apex code, you populate the questions as you create the Task. If users are creating the Task through the normal UI "new" button, then you add a trigger that uses the Tasks's WhatId and/or WhoId to find the object the Task is related to and then populate the relevant questions in the trigger.

Source Link
Keith C
  • 137.3k
  • 29
  • 218
  • 458
Loading