• Vivek 9
  • NEWBIE
  • 0 Points
  • Member since 2022

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 4
    Replies
public class invoice {

public Salesorder__c so{get;set;}
public Invoice__c i{get;set;}
public list<Salesorder_Line_Product__c> soliList{get;set;}
   public list<Invoice_Line_Product_No__c> iliList{get;set;}
public string s{get;set;}

public invoice ()
{
s=apexpages.currentpage().getparameters().get('id');

so= new Salesorder__c();
i=new Invoice__c();

soliList= new list <Salesorder_Line_Product__c>();
  iliList= new list <Invoice_Line_Product_No__c>();

so=[SELECT id,Account_Management__c,Contact_Management__c,Delivery_Lead_Time__c,Opportunity_Management__c,Payment_terms__c,Quote__c,Remarks__c,Salesorder_Date__c,Warranty__c FROM Salesorder__c WHERE id=:s];

soliList=[SELECT id,Account_Name__c,Actual_price__c,Balanced_Quantity__c,CGST__c,CGST_Amount__c,Product__c,Discounted_Price__c,Discount_Type__c,Discount_Value__c,IGST__c,Quote_Name__c,Product_Description__c,Quantity__c,Salesorder_Name__c,SGST__c,SGST_Amount__c,Total_Price__c,Unit_price__c FROM Salesorder_Line_Product__c WHERE Salesorder_Name__c=:s];



i.Salesorder__c=so.id;
i.Account_Management__c=so.Account_Management__c;
i.Contact_Management__c= so.Contact_Management__c;
i.Delivery_Lead_Time__c=so.Delivery_Lead_Time__c;
i.Opportunity_Management__c=so.Opportunity_Management__c;
i.Payment_terms__c=so.Payment_terms__c;
i.Quote__c=so.Quote__c;
  // i.Remarks__c = so.Remarks__c;
i.Valid_Till__c=so.Valid_Till__c;
i.Warranty__c=so.Warranty__c;

for(Salesorder_Line_Product__c sol:soliList)
{


Salesorder_Line_Product__c inv= new Salesorder_Line_Product__c ();
inv.Salesorder_Name__c=sol.Salesorder_Name__c;
inv.Account_Name__c=sol.Account_Name__c;
inv.Actual_Price__c =sol.Actual_Price__c;
 inv.Quantity__c = sol.Balanced_Quantity__c;   
inv.CGST__c =sol.CGST__c;               
inv.Product__c = sol.Product__c; 
inv.Discount_Type__c=sol.Discount_Type__c;
inv.Discount_Value__c=sol.Discount_Value__c;
inv.IGST__c=sol.IGST__c;
inv.Opportunity_Name__c=sol.Opportunity_Name__c;
inv.Product_Description__c=sol.Product_Description__c;
inv.Quote_Name__c = sol.Quote_Name__c;
inv.SGST__c=sol.SGST__c;
inv.Unit_Price__c=sol.Unit_Price__c;

 // iliList.add(inv);
}

}

public pageReference saveit()
{
    insert i;
    
    for(Invoice_Line_Product_No__c inv: iliList)
    {
   //  inv.Invoice__c = i.Id;
    }
    
    insert iliList;
    
    pageReference pr = new pageReference('/'+s);
    return pr;
    
}

public pageReference cancelit()
{
    
    pageReference pr = new pageReference('/'+s);
    return pr;

}
}
Getting errors invoice is not visible showing this error list has no rows for assignment to SObject
see question is
-Whenever we create new contact we entered email feild suppose arj@cyno.com.
-When we check after creating contact when we see details of contact that we create account name field already fill name cyno.
-in this we extract  doamin name from email and  account field already or automatic fill with name cyno......

-Please answer me using Trigger (trigger design pattern) and triggered flows
I want to create a custom button on list view page using visual force page to update mass records of account and also I want to hide that button from certain users. How can I achieve it using code