• Manu Kumar 2
  • NEWBIE
  • 10 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 2
    Replies

Hi Team,
Parent: Opportunity
Child: Opportunity Member
 I want to update an existing child of an opportunity if a field with the name primary is true on the existing child(Primary child) when a new child is inserted. We can only have one primary member(child record ) for the opportunity.  There is a field Amount on the Opportunity Member object and I want to update this field by subtracting the Amount of New Opportunity member(that we are inserting) from Primary Opportunity Member(an existing record).

My Code is working fine for a single record but not working as expected for bulk operation. Please help

Thank you

public class OppotunityMemberTriggerhandler{
 
   public static void afterInsert(List<Opportunity_Member__c> newoppMember){
          Set<Id> oppIdSet = new Set<Id>();
          List<Opportunity_Member__c> memberList = new List<Opportunity_Member__c>();
          Map<id,Opportunity_Member__c> oppMemberMap = new Map<id,Opportunity_Member__c>();
          List<Opportunity_Member__c> updatedMemberList = new List<Opportunity_Member__c>();
          
          
          for(Opportunity_Member__c newMember : newoppMember){
             oppIdSet.add(newMember.Opportunity__c);
          }
          if(oppIdSet.size()>0){
             memberList = [SELECT id,Amount__c,Opportunity__c,Primary__c FROM Opportunity_Member__c WHERE Opportunity__c IN :oppIdSet AND Primary__c = True ];
          }
          for(Opportunity_Member__c member : memberList){
            oppMemberMap.put(member.Opportunity__c,member);

          }
          for(Opportunity_Member__c oppMember : newoppMember){
              if(oppMember.Primary__c == False){
                for(Opportunity_Member__c primaryMember : memberList){
                    primaryMember.Amount__c = oppMemberMap.get(oppMember.Opportunity__c).Amount__c - oppMember.Amount__c;
                    updatedMemberList.add(primaryMember);
                 }
             }
          }
          update updatedMemberList;
   }    
}

Hi Team,
Parent: Opportunity
Child: Opportunity Member
 I want to update an existing child of an opportunity if a field with the name primary is true on the existing child(Primary child) when a new child is inserted. We can only have one primary member(child record ) for the opportunity.  There is a field Amount on the Opportunity Member object and I want to update this field by subtracting the Amount of New Opportunity member(that we are inserting) from Primary Opportunity Member(an existing record).

My Code is working fine for a single record but not working as expected for bulk operation. Please help

Thank you

public class OppotunityMemberTriggerhandler{
 
   public static void afterInsert(List<Opportunity_Member__c> newoppMember){
          Set<Id> oppIdSet = new Set<Id>();
          List<Opportunity_Member__c> memberList = new List<Opportunity_Member__c>();
          Map<id,Opportunity_Member__c> oppMemberMap = new Map<id,Opportunity_Member__c>();
          List<Opportunity_Member__c> updatedMemberList = new List<Opportunity_Member__c>();
          
          
          for(Opportunity_Member__c newMember : newoppMember){
             oppIdSet.add(newMember.Opportunity__c);
          }
          if(oppIdSet.size()>0){
             memberList = [SELECT id,Amount__c,Opportunity__c,Primary__c FROM Opportunity_Member__c WHERE Opportunity__c IN :oppIdSet AND Primary__c = True ];
          }
          for(Opportunity_Member__c member : memberList){
            oppMemberMap.put(member.Opportunity__c,member);

          }
          for(Opportunity_Member__c oppMember : newoppMember){
              if(oppMember.Primary__c == False){
                for(Opportunity_Member__c primaryMember : memberList){
                    primaryMember.Amount__c = oppMemberMap.get(oppMember.Opportunity__c).Amount__c - oppMember.Amount__c;
                    updatedMemberList.add(primaryMember);
                 }
             }
          }
          update updatedMemberList;
   }    
}
Hi All,
I wonder if anyone can help me on my below requirement.
I am trying to display html table in "Display Text" screen component in Field service Mobile flow. Below is my html code
<html>

<head >

 </head>

  <div id="card"> 

  <table>

  <thead>

    <tr>

      <th><FONT FACE="Arial" STYLE="font-size:12px" COLOR="#FF0000" LETTERSPACING="0" KERNING="0">Product Name</FONT></th>

      <th>Requested Quantity</th>

      <th>Sent Quantity</th>

    </tr>

  </thead>

  <tbody>

    <tr>

      <td data-label="Product Name"> { !VarprodName }</td>

      <td data-label="Requested Quantity">{ !VarQuantityReceived }</td>

      <td data-label="Sent Quantity">{ !VarQuantitysent }</td>
    
     </tr>

   </tbody>

</table>

</div>

</html>

When I run this flow from desktop then, it is working fine and proper html table is showing. But If I run this flow in Field Service Mobile app then html table is not displaying. Main issue is html tag are not working in fsl app.
So I'm looking for some advice how can we apply html or css in fsl mobile app.
Any help regarding this would be highly appreciated.
Table in Mobile:
User-added image

Table in Desktop
User-added image
Kind Regards,
Pawan