• Billbay
  • NEWBIE
  • 20 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 5
    Replies
Hi,

I have never done an integration before. Building my first interface to a business application running on-premise with a MS SQL Server database. This app contains data that I need to bring into my salesforce app.

I am looking to build an interface/integration such that data is retrieved on a schedule from the MS SQL db and have it updated onto my Salesforce app.

Can someone point me to a go-to place where I can figure this out?

Thanks,
BillBay
Hi, I tried reading up on static boolean variables and tried using them with not much success. Can somebody help how I can prevent recursive triggering in the below example? Many thanks!

First Trigger updates Invoice a dollar value equal to the sum of the dollar value from Permits which have a matching Invoice number. As below:

trigger InvoiceAmountUpdate on Permit__c (after update) {

for(Permit__c obj : trigger.new)
{
    List<Permit__c> permit = [select Total1__c from Permit__c p where p.Invoice_Num__c = :obj.Invoice_Num__c];

    decimal sum = 0;
    for (Permit__c p : permit) {sum = sum + p.Total1__c;}
    List<bb_Invoice__c> invoice = [select Invoice_Amount__c from bb_Invoice__c i where i.id = :obj.Invoice_Num__c];
    
for (bb_Invoice__c i : invoice) {
        i.Invoice_Amount__c = sum;
        update i;
    }
}
}

Second Trigger updates payment amount on Permits when the full invoice value is paid. However, with each update on Permit, the first trigger is called ending in a recursive pattern

trigger PaymentStatusUpdate on bb_Invoice__c (before update) {

for(bb_Invoice__c obj : trigger.new)
{
   if (obj.Paid_Amount__c>=obj.Invoice_Amount__c) {
    obj.Payment_Status__c = 'Paid';
   
List<Permit__c> permit = [select Total1__c,Paid__c from Permit__c p where p.Invoice_Num__c = :obj.id];

    for (Permit__c p : permit) {
        p.Paid__c = p.Total1__c;
        update p;
    }
    } 

    else if (obj.Paid_Amount__c>0) {
    if (obj.Paid_Amount__c<obj.Invoice_Amount__c) {
    obj.Payment_Status__c = 'Partially Paid';
    } 
    }
}
Hi,

I have defined Object A (master) and Object B (detail) in  a master-detail relationship. I have also defined Object A.field-x inside Object B as Object B.field-x.

When Object B.field-y is populated, I would like to auto-populate Object B.field-x where ObjectB.field-y is the controlling field? Unfortunately, the standard auto-populate fields update using a workflow rule does not work as Object B.field-x is not one of the fields available for auto-population.

Thanks,
Maythil
Hi,

I have never done an integration before. Building my first interface to a business application running on-premise with a MS SQL Server database. This app contains data that I need to bring into my salesforce app.

I am looking to build an interface/integration such that data is retrieved on a schedule from the MS SQL db and have it updated onto my Salesforce app.

Can someone point me to a go-to place where I can figure this out?

Thanks,
BillBay
Hi, I tried reading up on static boolean variables and tried using them with not much success. Can somebody help how I can prevent recursive triggering in the below example? Many thanks!

First Trigger updates Invoice a dollar value equal to the sum of the dollar value from Permits which have a matching Invoice number. As below:

trigger InvoiceAmountUpdate on Permit__c (after update) {

for(Permit__c obj : trigger.new)
{
    List<Permit__c> permit = [select Total1__c from Permit__c p where p.Invoice_Num__c = :obj.Invoice_Num__c];

    decimal sum = 0;
    for (Permit__c p : permit) {sum = sum + p.Total1__c;}
    List<bb_Invoice__c> invoice = [select Invoice_Amount__c from bb_Invoice__c i where i.id = :obj.Invoice_Num__c];
    
for (bb_Invoice__c i : invoice) {
        i.Invoice_Amount__c = sum;
        update i;
    }
}
}

Second Trigger updates payment amount on Permits when the full invoice value is paid. However, with each update on Permit, the first trigger is called ending in a recursive pattern

trigger PaymentStatusUpdate on bb_Invoice__c (before update) {

for(bb_Invoice__c obj : trigger.new)
{
   if (obj.Paid_Amount__c>=obj.Invoice_Amount__c) {
    obj.Payment_Status__c = 'Paid';
   
List<Permit__c> permit = [select Total1__c,Paid__c from Permit__c p where p.Invoice_Num__c = :obj.id];

    for (Permit__c p : permit) {
        p.Paid__c = p.Total1__c;
        update p;
    }
    } 

    else if (obj.Paid_Amount__c>0) {
    if (obj.Paid_Amount__c<obj.Invoice_Amount__c) {
    obj.Payment_Status__c = 'Partially Paid';
    } 
    }
}
Hi,

I have defined Object A (master) and Object B (detail) in  a master-detail relationship. I have also defined Object A.field-x inside Object B as Object B.field-x.

When Object B.field-y is populated, I would like to auto-populate Object B.field-x where ObjectB.field-y is the controlling field? Unfortunately, the standard auto-populate fields update using a workflow rule does not work as Object B.field-x is not one of the fields available for auto-population.

Thanks,
Maythil