• Kristi Gray
  • NEWBIE
  • 30 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 10
    Replies
We have a Flow where Project Managers are able to click an 'Add Services' button on their Project, which enables them to select multiple services on the Screen displayed to add to the Project. However, they must go into each Selected Service to update the Quantity, Phase, and Custom Description. The Custom Description automatically populates with the description of that service. However, sometimes they like to be able to modify that description. The Quantity automatically populates with 1 and the Phase remains at No Phase. Is there a way for me to add a Screen after the first Screen where the Quantity, Phase, and Custom Description (with the description of the service already populated but with the ability to modify it) of all of the selected services from Screen 1 can be modified all at once?
How would I write the test for the below trigger?

trigger updtrichtextfld on Selected_Service__c (before insert) {
Set<Id> serviceIds = new set<Id>();
Map<Id, string> serviceMap = new Map<Id, string>();
for(Selected_Service__c ss : Trigger.new)
{
    serviceIds.add(ss.Service__c); //to fetch related Id
}
//Description field needs to be queried else will result in null
for(Service__c ser : [select id, Deliverables__c from Service__c where id in: serviceIds])
{
    serviceMap.put(ser.id, ser.Deliverables__c);
}
for(Selected_Service__c u : trigger.new)
{
    //Selected_Service__c.Custom_Description__c=Service__c.Deliverables__c; This is wrong
    u.Custom_Description__c = serviceMap.get(u.Service__c);
}
}

I have been able to write the following so far but it is giving me the error "Illegal assignment from List to Selected_Service__c"

@isTest

public class updtrichtextfldtest
{
    static testMethod void testUnit()
    {
     Selected_Service__c ss = new Selected_Service__c();
        ss = [
            SELECT Id, Deliverables__c
            From Service__c
            Where Id = :ss.Id
        ];
    }
}
Hi! I am REALLY new to coding. I cannot seem to get this simple trigger to work. I want the rich text from my Service__c.Deliverables__c to be copied to Selected_Service__c.Custom_Description__c. What am I doing wrong? It gives me the error 'A value cannot be stored to Custom_Description__c in type Selected_Service__c

trigger updtrichtextfld on Selected_Service__c (before insert) {

for(Selected_Service__c u:trigger.new){
Selected_Service__c.Custom_Description__c=Service__c.Deliverables__c;
}
}
When a project manager puts together a proposal, they can click on a button to create a pdf document of that proposal. We have Services as an object which contains all services that are available to project managers to add to proposals. The Services have a short description that is included on the proposal. The proposal has Selected Services where the PM has selected specific Services for their proposal. Sometimes the PM wants to change the short description to customize their proposal. So instead of the pdf document displaying the Services' short description, I need it to display the custom description on the Selected Service. They have requested that this custom description be displayed in a separate table on the pdf below the table with the normal short description. However, when I change the code on the pdf document to use the custom description field, I get an error. Here is the code. What am I doing wrong? The part that I have in bold I have changed to !NoPhases.Custom_Description__c but then the pdf no longer works.

<apex:outputPanel rendered="{!Opportunity.Total_Phase_1_Sel_Services__c = 0}"> <table width="100%" style="border-collapse:collapse;"> <tr style="page-break-inside:avoid;"> <td width="40%" style="background:#808080;border: thin black solid;text-align:center;"><b>Services</b></td> <td width="60%" style="background:#808080;border: thin black solid;text-align:center;"><b>Deliverables</b></td> </tr> <apex:repeat var="NoPhases" value="{!selectedServices}"> <tr style="page-break-inside:avoid;"> <td style="background:#D9D9D9;border: thin black solid;text-align:left;padding-left:10px;">{!NoPhases.Service__r.Name}</td> <td style="background:#D9D9D9;border: thin black solid;text-align:left;padding-left:10px;"><apex:outputfield value="{!NoPhases.Service__r.Deliverables__c}"/></td> </tr> </apex:repeat> </table> </apex:outputPanel>
How would I write the test for the below trigger?

trigger updtrichtextfld on Selected_Service__c (before insert) {
Set<Id> serviceIds = new set<Id>();
Map<Id, string> serviceMap = new Map<Id, string>();
for(Selected_Service__c ss : Trigger.new)
{
    serviceIds.add(ss.Service__c); //to fetch related Id
}
//Description field needs to be queried else will result in null
for(Service__c ser : [select id, Deliverables__c from Service__c where id in: serviceIds])
{
    serviceMap.put(ser.id, ser.Deliverables__c);
}
for(Selected_Service__c u : trigger.new)
{
    //Selected_Service__c.Custom_Description__c=Service__c.Deliverables__c; This is wrong
    u.Custom_Description__c = serviceMap.get(u.Service__c);
}
}

I have been able to write the following so far but it is giving me the error "Illegal assignment from List to Selected_Service__c"

@isTest

public class updtrichtextfldtest
{
    static testMethod void testUnit()
    {
     Selected_Service__c ss = new Selected_Service__c();
        ss = [
            SELECT Id, Deliverables__c
            From Service__c
            Where Id = :ss.Id
        ];
    }
}
Hi! I am REALLY new to coding. I cannot seem to get this simple trigger to work. I want the rich text from my Service__c.Deliverables__c to be copied to Selected_Service__c.Custom_Description__c. What am I doing wrong? It gives me the error 'A value cannot be stored to Custom_Description__c in type Selected_Service__c

trigger updtrichtextfld on Selected_Service__c (before insert) {

for(Selected_Service__c u:trigger.new){
Selected_Service__c.Custom_Description__c=Service__c.Deliverables__c;
}
}
When a project manager puts together a proposal, they can click on a button to create a pdf document of that proposal. We have Services as an object which contains all services that are available to project managers to add to proposals. The Services have a short description that is included on the proposal. The proposal has Selected Services where the PM has selected specific Services for their proposal. Sometimes the PM wants to change the short description to customize their proposal. So instead of the pdf document displaying the Services' short description, I need it to display the custom description on the Selected Service. They have requested that this custom description be displayed in a separate table on the pdf below the table with the normal short description. However, when I change the code on the pdf document to use the custom description field, I get an error. Here is the code. What am I doing wrong? The part that I have in bold I have changed to !NoPhases.Custom_Description__c but then the pdf no longer works.

<apex:outputPanel rendered="{!Opportunity.Total_Phase_1_Sel_Services__c = 0}"> <table width="100%" style="border-collapse:collapse;"> <tr style="page-break-inside:avoid;"> <td width="40%" style="background:#808080;border: thin black solid;text-align:center;"><b>Services</b></td> <td width="60%" style="background:#808080;border: thin black solid;text-align:center;"><b>Deliverables</b></td> </tr> <apex:repeat var="NoPhases" value="{!selectedServices}"> <tr style="page-break-inside:avoid;"> <td style="background:#D9D9D9;border: thin black solid;text-align:left;padding-left:10px;">{!NoPhases.Service__r.Name}</td> <td style="background:#D9D9D9;border: thin black solid;text-align:left;padding-left:10px;"><apex:outputfield value="{!NoPhases.Service__r.Deliverables__c}"/></td> </tr> </apex:repeat> </table> </apex:outputPanel>