• Samuel Gonsalves 8
  • NEWBIE
  • 10 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 18
    Questions
  • 17
    Replies
Hi Team,

I have 2 objects quote and invoice. Whenever quote is created and when it is updated to Approved , all data goes to invoice object and a invoice record get created.
My problem is when anytime other fields in quote is updated again the trigger runs and a new invoice gets created. i just want my trigger to run only once. This is my code.

trigger createInvoiceQuote on Quote (after update)
{
   
   
    if(trigger.isAfter){
    set<id> oppIds = new set<id>();
    list<Invoicing__c> newInvoiceList = new list<Invoicing__c>();
    list<Quote> QuoteList = new list<Quote>();
    map<id,id> conRoleMap = new map<id, id>();
    set<id> accSet = new set<id>();
    map<id, contact> accConMap = new map<id , contact>();

    QuoteList = [select id, status, name, isSyncing, opportunityId, contact.Billing_Contact__c , contactId, opportunity.Fieldwork_Stage__c, AccountId, Account.GST_Setting__c from quote where id IN: trigger.newMap.keyset()];
    
    system.debug('QuoteList' + QuoteList);
    
    for(Quote quo : QuoteList){
        if(quo.isSyncing && quo.Status.equalsIgnoreCase('Approved')){
                oppIds.add(quo.opportunityId);
                accSet.add(quo.AccountId);
        }
    }
    
    for(OpportunityContactRole conRole : [select id, contactId, IsPrimary, opportunityId from OpportunityContactRole where opportunityId in: oppIds AND isPrimary = true])
    {
        conRoleMap.put(conRole.opportunityId , conRole.contactId);
    }
    
    for(contact con : [select id, accountId, email, billing_Contact__c from contact where id in: conRoleMap.values() OR (accountId in: accSet AND Billing_Contact__c = true)])
    {
        accConMap.put(con.AccountId , con);
        accConMap.put(con.id , con);
    }
    
    system.debug('conRoleMap ' + conRoleMap);

    for(Quote quo : QuoteList){
        if(quo.isSyncing && quo.Status.equalsIgnoreCase('Approved')){               
            Invoicing__c inv = new Invoicing__c();
            inv.Quote__c = quo.Id;
            inv.Invoice_Name__c = quo.Name;
            inv.Status__c = quo.opportunity.Fieldwork_Stage__c;
            inv.Opportunity_Name__c = quo.OpportunityId;
            inv.GST_Setting__c = quo.Account.GST_Setting__c;
        if(accConMap.containsKey(quo.AccountId)){
            Contact secCon = accConMap.get(quo.AccountId);
            if(secCon.Billing_Contact__c){
                inv.Secondary_Billing_Contact__c = secCon.Id;
                inv.Secondary_Billing_Contact_Email_id__c = secCon.email;
            }
        }
        if(conRoleMap.containsKey(quo.OpportunityId)){
            inv.Primary_Billing_Contact__c = conRoleMap.get(quo.OpportunityId);
            if(accConMap.containsKey(conRoleMap.get(quo.OpportunityId)))
                inv.Primary_Billing_Contact_Email_id__c = accConMap.get(conRoleMap.get(quo.OpportunityId)).email;
        }
            newInvoiceList.add(inv);
        }
    }
        
        for(Invoicing__c inv : [select id, Opportunity_Name__c from Invoicing__c where Opportunity_Name__c in: oppIds]){
            inv.Opportunity_Name__c = null;
            newInvoiceList.add(inv);
        }
        
        upsert newInvoiceList;
    }

}

Can anyone please help. Need it urgently

Thanks.

Regards,
Samuel
 
Hi Team,

I have two fields "Start Date" and "End Date". Everytime my Start dates and End date will be like 1/1/2015 to 31/12/2015 or 1/1/2015 to 30/12/2015 depending on days in a month. I want to create report based on current month and last month as filters. For eg :
Todays date is 2/9/2015 (So current month is sept),
In this case it should only take Start date = 1/9/2015 and End Date=30/9/2015 in current month and Start date = 1/8/2015 and End Date=31/8/2015 as Last month reporting.

Can anyone have any suggestion how i can acheive this? Need urgently
Thanks

Regards,
Samuel
Hi All,
I need to create a formula field "Branding Theme" with return type "TEXT" which will basically update a particular value based on the owner selected in opportunity. Also needed the quote number from quote to be display besides it. Have tried this
IF(TEXT( Owner.Username )='sam@gmail.com','PPAU &""&  SyncedQuote.QuoteNumber ',
   TEXT( Owner.Username )='kishor@gmail.com','PPUS &""&  SyncedQuote.QuoteNumber '
)

But this is not working . Can anyone please help me out with this?

Thanks

Regards,
Samuel
Hi All,

I want to save data in Json in salesforce but while creating a field i dont have Json datatype. I dont want to saved it as string  / Text. I want to do it same as postgreS.

can we do this ? Need to know this as ASAP

Thanks

Samuel
Hi All,

From sandbox to production Environment.
I want to some custom objects along with the trigger but i get an Error
"invalid parameter value".
(i check online and found that the reason could be "view all data" permission provided..but i check in sandbox and it was not provided)

From Production to Sandbox
I was transferring some objects from production to sandox but got this error.
" In field: userLicense - no UserLicense named Force.com - App Subscription found "
( In production i have force.com license also.)

Please need an urgent help on this. Thanks.

Regards,
Samuel
Hi All,

Just need to know if i create a connected APP , can it access all the objects in salesforce. What if need to provide for a specific object?

Thanks

Regards,
Samuel
I have a custom object Campaign_Metric__c which has a lookup with opportunity and it under related list of opportunity. I want to create a "ADD" button in "campaign metric" related list under opportunity. When i will click on "ADD" button it should show me a page where i can search for campaign metric and add one by one in opportunity. It should work somewhat like contact role where i can add multiple "campaign metric" under "opportunity".

Need a urgent help on this.

Thanks.

Regards,
Samuel


 
Hi All,

In opportunity i have created an INVOICING object. I want all the quote line items details to get UPDATE OR CREATE under invoicing object. When a new product is added under quote same should be created in invoicing object.

Product: Line Item Description-details copied from the quote

Quoted Sales Price - details copied from the quote
Invoice Sales Price(Invoicing Object)

Quoted Quantity-details copied from the quote
Invoice Quantity (Invoicing Object)

Quoted Total Price-details copied from the quote
Invoice Total Price (Invoicing Object)

Can anyone please help me out with this.

Thanks.

Regards,
Samuel

 
Hi All,

I was updating some opportunty data through data loader but got plenty of same error
Error :
Apex script unhandled trigger exception by user/organization: 00590000002bdRR/
00D90000000siXo
OptyStatus: System.LimitException: quotesync:Too many SOQL queries: 101

"Optystatus" is the trigger which is been created in our org

This trigger is used to update all the quote status to "Rejected" when the associated Opportunity Stage is changed to "Closed Lost". trigger OptyStatus on Opportunity (after update)  { try { Set<String> Opty=new Set<String>(); for(Opportunity Opp : Trigger.new) {     if(Opp.StageName=='Closed Lost')     {     Opty.add(Opp.Id);     List<Quote> Qu = [SELECT Id, Name FROM Quote WHERE OpportunityId in: Opty];     if(Qu.size()>0)         {             for(Quote qut : Qu)                 {                 qut.Status='Rejected';                 }                       try                 {                 update Qu;                 }// try ends                 catch (DMLException e)                 {                 System.debug('An unexpected error has occurred while updating Quote: ' + e.getMessage());                 }        }             } } }//try ends catch(Exception ex) { System.debug('An unexpected error has occurred: ' + ex.getMessage()); } }

Can anyone help me out to remove this error.

Thanks in advance.

Regards,
Samuel

 
Hi All,

I have a user which has "Force.com Subcription license". He cannot able to access the report which is been saved under Unfied public report. I have even change the folder and given access to that folder but still getting the same error as "Insufficient Privelege".
Can anyone please help me out with this.

Thanks,

Regards,
Samuel
Hi Team,

I have a custom field Country__c into my quote line item and also the same into Opportunity Products. I enter the country details into my quote line item. When i start sync of that quote all the information get capture into opportunity product except the custom field "Country__c". Can anyone please help me out with this. I tried an app "Custom Quote Sync (Managed)" but that too doesnt work for me. Can anyone help me out with this or a code to achieve this.

Thanks in advance.

Regards,
Samuel
 
Hi All,
I have a ‘Status’ field in Accounts with values below
1. Inactive
2. Active
3. New
4. Reactivated
Can we automate the following:
a. Change the status of an Account with ‘Active’ status to ‘Inactive’ if they haven’t had an opportunity closed won in the last 12 months
b. Change the status of an Account with ‘Inactive’ status to ‘Reactivated’ as soon as the Account has a Closed Won opportunity

Thanks.

Regards,
Samuel
Hi Team,

Can anyone help me out how we can remove a report of chatter feeds and everthing related to chatter. I Want to remove report based on REST API and also through a Salesforce Report function. But i cannot able to do from both. Can anyone help me out with this.

Thanks.

Regards,
Samuel
Hi Team.

When i click on "add line items" in quote the page shows me a list of products. When i select a particular number of products, i want through a button a visualforce page to be open which shows the furthers fields related to each product. User-added image

I.E. If I add a new item of type "A", in the mini page layout, I need to show Fields "X", "Y", "Z". If I add a new item of type "B", in the mini page layout, I need to show fields "X", "Z".

I'm kind of Salesforce newbie in development. Please need a urgent help on this.

Regards,
Samuel Gonsalves
Hi All,
Opportunity product details generally stay the same, but the quantity and list price may need to be updated for the invoices (yes invoice could be different to the opportunity which is normally the case). How can i achieve this
Thanks in advance.

Regards,
Samuel
Hi All,
We are a Market research company where we create survey and charge customer for the number of survey complete. "Survey Respondents" is the name of the product.
Now Price of "Survey Respondents" for 1000 complete is 500$. But we only able to provide 970 complete.
Currently in salesforce we need to set prize for every product. How we will be able to work in this senario.
Either through a third party App or any development. Not sure how we can proceed with this. Need a urgent help and suggestion.
Thanks.

Regards,
Samuel Gonsalves
Hi All,

I need to update Opportunity stage to closed lost when all the quotes inside that opportunity is been updated as rejected.

Can any one help me out with this?

Thanks in advance.

Regards
Samuel Gonsalves.
Hi All,

1. We would like accounts which have not had any opportunity against it to be automatically move to inactive.
2. If they have not created any opportunity in 12 months or more they should be marked as inactive.

can anyone please help me to achieve this

Regards,
Samuel
Hi Team,

I have 2 objects quote and invoice. Whenever quote is created and when it is updated to Approved , all data goes to invoice object and a invoice record get created.
My problem is when anytime other fields in quote is updated again the trigger runs and a new invoice gets created. i just want my trigger to run only once. This is my code.

trigger createInvoiceQuote on Quote (after update)
{
   
   
    if(trigger.isAfter){
    set<id> oppIds = new set<id>();
    list<Invoicing__c> newInvoiceList = new list<Invoicing__c>();
    list<Quote> QuoteList = new list<Quote>();
    map<id,id> conRoleMap = new map<id, id>();
    set<id> accSet = new set<id>();
    map<id, contact> accConMap = new map<id , contact>();

    QuoteList = [select id, status, name, isSyncing, opportunityId, contact.Billing_Contact__c , contactId, opportunity.Fieldwork_Stage__c, AccountId, Account.GST_Setting__c from quote where id IN: trigger.newMap.keyset()];
    
    system.debug('QuoteList' + QuoteList);
    
    for(Quote quo : QuoteList){
        if(quo.isSyncing && quo.Status.equalsIgnoreCase('Approved')){
                oppIds.add(quo.opportunityId);
                accSet.add(quo.AccountId);
        }
    }
    
    for(OpportunityContactRole conRole : [select id, contactId, IsPrimary, opportunityId from OpportunityContactRole where opportunityId in: oppIds AND isPrimary = true])
    {
        conRoleMap.put(conRole.opportunityId , conRole.contactId);
    }
    
    for(contact con : [select id, accountId, email, billing_Contact__c from contact where id in: conRoleMap.values() OR (accountId in: accSet AND Billing_Contact__c = true)])
    {
        accConMap.put(con.AccountId , con);
        accConMap.put(con.id , con);
    }
    
    system.debug('conRoleMap ' + conRoleMap);

    for(Quote quo : QuoteList){
        if(quo.isSyncing && quo.Status.equalsIgnoreCase('Approved')){               
            Invoicing__c inv = new Invoicing__c();
            inv.Quote__c = quo.Id;
            inv.Invoice_Name__c = quo.Name;
            inv.Status__c = quo.opportunity.Fieldwork_Stage__c;
            inv.Opportunity_Name__c = quo.OpportunityId;
            inv.GST_Setting__c = quo.Account.GST_Setting__c;
        if(accConMap.containsKey(quo.AccountId)){
            Contact secCon = accConMap.get(quo.AccountId);
            if(secCon.Billing_Contact__c){
                inv.Secondary_Billing_Contact__c = secCon.Id;
                inv.Secondary_Billing_Contact_Email_id__c = secCon.email;
            }
        }
        if(conRoleMap.containsKey(quo.OpportunityId)){
            inv.Primary_Billing_Contact__c = conRoleMap.get(quo.OpportunityId);
            if(accConMap.containsKey(conRoleMap.get(quo.OpportunityId)))
                inv.Primary_Billing_Contact_Email_id__c = accConMap.get(conRoleMap.get(quo.OpportunityId)).email;
        }
            newInvoiceList.add(inv);
        }
    }
        
        for(Invoicing__c inv : [select id, Opportunity_Name__c from Invoicing__c where Opportunity_Name__c in: oppIds]){
            inv.Opportunity_Name__c = null;
            newInvoiceList.add(inv);
        }
        
        upsert newInvoiceList;
    }

}

Can anyone please help. Need it urgently

Thanks.

Regards,
Samuel
 
Hi All,
I need to create a formula field "Branding Theme" with return type "TEXT" which will basically update a particular value based on the owner selected in opportunity. Also needed the quote number from quote to be display besides it. Have tried this
IF(TEXT( Owner.Username )='sam@gmail.com','PPAU &""&  SyncedQuote.QuoteNumber ',
   TEXT( Owner.Username )='kishor@gmail.com','PPUS &""&  SyncedQuote.QuoteNumber '
)

But this is not working . Can anyone please help me out with this?

Thanks

Regards,
Samuel
Hi All,

From sandbox to production Environment.
I want to some custom objects along with the trigger but i get an Error
"invalid parameter value".
(i check online and found that the reason could be "view all data" permission provided..but i check in sandbox and it was not provided)

From Production to Sandbox
I was transferring some objects from production to sandox but got this error.
" In field: userLicense - no UserLicense named Force.com - App Subscription found "
( In production i have force.com license also.)

Please need an urgent help on this. Thanks.

Regards,
Samuel
Hi All,

Just need to know if i create a connected APP , can it access all the objects in salesforce. What if need to provide for a specific object?

Thanks

Regards,
Samuel
Hi All,

In opportunity i have created an INVOICING object. I want all the quote line items details to get UPDATE OR CREATE under invoicing object. When a new product is added under quote same should be created in invoicing object.

Product: Line Item Description-details copied from the quote

Quoted Sales Price - details copied from the quote
Invoice Sales Price(Invoicing Object)

Quoted Quantity-details copied from the quote
Invoice Quantity (Invoicing Object)

Quoted Total Price-details copied from the quote
Invoice Total Price (Invoicing Object)

Can anyone please help me out with this.

Thanks.

Regards,
Samuel

 
Hi All,

I was updating some opportunty data through data loader but got plenty of same error
Error :
Apex script unhandled trigger exception by user/organization: 00590000002bdRR/
00D90000000siXo
OptyStatus: System.LimitException: quotesync:Too many SOQL queries: 101

"Optystatus" is the trigger which is been created in our org

This trigger is used to update all the quote status to "Rejected" when the associated Opportunity Stage is changed to "Closed Lost". trigger OptyStatus on Opportunity (after update)  { try { Set<String> Opty=new Set<String>(); for(Opportunity Opp : Trigger.new) {     if(Opp.StageName=='Closed Lost')     {     Opty.add(Opp.Id);     List<Quote> Qu = [SELECT Id, Name FROM Quote WHERE OpportunityId in: Opty];     if(Qu.size()>0)         {             for(Quote qut : Qu)                 {                 qut.Status='Rejected';                 }                       try                 {                 update Qu;                 }// try ends                 catch (DMLException e)                 {                 System.debug('An unexpected error has occurred while updating Quote: ' + e.getMessage());                 }        }             } } }//try ends catch(Exception ex) { System.debug('An unexpected error has occurred: ' + ex.getMessage()); } }

Can anyone help me out to remove this error.

Thanks in advance.

Regards,
Samuel

 
Hi All,

I have a user which has "Force.com Subcription license". He cannot able to access the report which is been saved under Unfied public report. I have even change the folder and given access to that folder but still getting the same error as "Insufficient Privelege".
Can anyone please help me out with this.

Thanks,

Regards,
Samuel
Hi Team.

When i click on "add line items" in quote the page shows me a list of products. When i select a particular number of products, i want through a button a visualforce page to be open which shows the furthers fields related to each product. User-added image

I.E. If I add a new item of type "A", in the mini page layout, I need to show Fields "X", "Y", "Z". If I add a new item of type "B", in the mini page layout, I need to show fields "X", "Z".

I'm kind of Salesforce newbie in development. Please need a urgent help on this.

Regards,
Samuel Gonsalves
Hi All,
We are a Market research company where we create survey and charge customer for the number of survey complete. "Survey Respondents" is the name of the product.
Now Price of "Survey Respondents" for 1000 complete is 500$. But we only able to provide 970 complete.
Currently in salesforce we need to set prize for every product. How we will be able to work in this senario.
Either through a third party App or any development. Not sure how we can proceed with this. Need a urgent help and suggestion.
Thanks.

Regards,
Samuel Gonsalves
Hi All,

1. We would like accounts which have not had any opportunity against it to be automatically move to inactive.
2. If they have not created any opportunity in 12 months or more they should be marked as inactive.

can anyone please help me to achieve this

Regards,
Samuel