• Technomile Admin 6
  • NEWBIE
  • 0 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 2
    Replies
I am creating the containt version record programatically, I need to share this record with specific user as soon as it get created. Can i atchive this progeramaticall using trigger or writing code after containt version insertion code.

Thanks.
---------------VF page------------------------------
<apex:page controller="abc1" >
  <apex:form >
      <apex:pageBlock >
          <apex:pageBlockTable value="{!pqr}" var="a">
              <apex:column headerValue="Gold">
                  <apex:outputtext value="{!a}" />                
              </apex:column>
              <apex:column headerValue="10%">
                  <apex:inputtext value="{!t1}"/>
              </apex:column>
              <apex:column headerValue="30%">
                  <apex:inputtext value="{!t2}"/>
              </apex:column>
              <apex:column headerValue="50%">
                  <apex:inputtext value="{!t3}"/>
              </apex:column>
          </apex:pageBlockTable>
          <apex:pageBlockButtons >
              <apex:commandButton value="Save" action="{!qsave}" />
          </apex:pageBlockButtons>
      </apex:pageBlock>
  </apex:form>
</apex:page>
-----------/VF Page-----------------

-------------controller Class-------------

public class abc1
{
    public List<Decimal> t1 { get; set; }
    public List<Decimal> t2 { get; set; }
    public List<Decimal> t3 { get; set; }
    public List<String> pqr {get; set;}
    public abc1()
    {
        pqr=new List<String>();
        Schema.DescribeFieldResult fieldResult =Account.a__c.getDescribe();
        List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues();
        for( Schema.PicklistEntry f:ple)
       {    
          pqr.add(f.getLabel());
       }    
       System.debug(pqr);
    }
    
    public void qsave()
    {    
        System.debug('1');
        Integer i=0;
        List<Quality__c> qqq =new List<Quality__c>();
        Quality__c ccc;
        for(String x:pqr)
        {    System.debug(x);
            ccc= new  Quality__c(Name=x, ab__c=t1[i]);
            qqq.add(ccc);
            System.debug(qqq);
            i++;
        }  
        try
        {
            upsert qqq;
        }
        catch(System.Exception e)
        {
            System.Debug(e);
        }
    }  
}User-added image