• Poorna Developer
  • NEWBIE
  • 50 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 13
    Questions
  • 2
    Replies
Hi Everyone,

I have created a lwc with my custom object name Loan__c and Standard object Contact. Both have look-up relation. When I choose contact name from the list it will the show related loan details in the Loan__c.
User-added image

Once I remove the contact from the field I need to remove Loan data from Loan look-up also.
Is any possible to remove the loan when the contact removed.
Code:
import { LightningElement,track,wire,api } from 'lwc';
import getDetails from '@salesforce/apex/LoanController.getDetails';
import { getRecord } from 'lightning/uiRecordApi';
export default class TransactionDetails extends LightningElement {
@api accountId;
@track display=true;
@track cl='true';
@track aId='true';
@track cId='true';
@track acId='true';
@track cnId='true';
@track cloans= '';
@track selectedLoanId;
@track handleRemovePill;
@track contactname;
@track accountname;
@track _recordId;
@track transaction;
@track loans;
hasRendered=false;
ContactoptionList=[];
isClicked=false;
connectedCallback()
{
this.getLabelDetails();
}
@api
get recordId(){
return this._recordId;
}
set recordId(val){
this._recordId = val;
}
selectedContact(event)
{
debugger;
if(this.isClicked){
this.cloans= ''; // display all the loans
this.aId=true;
this.isClicked=false;
this.contactId='';
if(this.contactId=='' && this.selectedLoanId!='')
{
this.cloans='';
this.selectedLoanId=''; //Clear loan from list
console.log('ok'+this.selectedLoanId);
}
}
else{
this.contactId = event.detail.selectedId;
this.cloans = 'Contact__c=\''+this.contactId+'\'';
this.aId=false;
this.isClicked=true;
}
}

 
Hi Everyone,

I have a object named  'Application__c' and Picklist field named 'Stage__c'['Red', 'Blue','Pink','Black']

Whenever the 'Stage__c'  picklist value is changed I need to track that field value.
ie. When picklist value changed from Red -> Blue I need to track this field in my trigger. Is this possible?
Any help.
Thankyou all.
I have an object called 'Application__c' and field in that called 'Customer_Id__c'.
I need to pass the Customer_Id__c to apex class whenever user enter the data in the object.

User-added image
Apex class
public static void passvalue() { String getcusid; Loan_Application__c lapp = new Loan_Application__c(); getcusid=lapp.Saltedge_Customer_Id__c; System.debug('customerid from sf' +getcusid); }

Trigger to get Customer_Id__c data whenever user given in the object.

User-added image

Is there any idea ?
Thanks.


 
Hi,
From process builder getting record id and pass that in to apex.

User-added image
Apex class to update the record:

public class BacktoQuantum
{
     @InvocableMethod(label='getdata' description='Get data from saltedge')
  public static void toquantum(List<String> ids)
    {
       BacktoQuantum.fromdata(ids);
       //System.debug('callback');
      
  }
   @future(callout=true)
    public static void fromdata(List<String> ids)
   {
         Http http = new Http();
            HttpRequest request = new HttpRequest();
            request.setEndpoint('http://ussd.apmuyea.software.com/CustomerAdd_SaltEdge_CallBack.aspx');
            request.setMethod('GET');
            //request.setHeader('Accept','application/json');
            request.setHeader('Content-Type', 'text/html; charset=utf-8');
            request.setBody('{"data": {Saltedge Data }}');
       
            HttpResponse responseg = http.send(request);  
            System.debug(responseg.getBody());
        String ac = responseg.getBody(); //Return JSON data
      List<Loan_Application__c> app =  [Select Amount__c,Rate__c,Term_Months__c from Loan_Application__c where Id=:ids];
       if(!app.isEmpty())
       {
                // app[0];
// To update the JSON data in the first record in the list
       }
        //Loan_Application__c app =  new Loan_Application__c();
       //app.SaltedgeData__c = ac;
       //System.debug('sample json' +app);
         } 
}

The above apex code return a JSON data, I need to store that JSON data in salesforce field called Saltedge__c.
I'm stuck in the update.

can anyone help to me update the record?

Thanks.
Hi Everyone,

I have JSON data. I wish to store this JSON data in my custom object field.
Is this possible in salesforce? Any idea?
Thanks in Advance.

Hi All,

I have a apex code to connect a third party API,

public with sharing class Saltedgelead 
{
    
      @InvocableMethod(label='leadsession' description='Create salt edge lead session')
    public static void leadtest()
        {
            Saltedgelead.geturl();
        }
    public static void geturl()
    { 
        String uri;
            Http http = new Http();
            HttpRequest request = new HttpRequest();
            request.setEndpoint('https://www.saltedge.com/api/partners/v1/lead_sessions/create');
            request.setMethod('POST');
            request.setHeader('Accept','application/json');
            request.setHeader('Content-Type', 'application/json');
            request.setHeader('App-id', 'q_-XTJ_zMjDdH3PiTTSY1q_SbhxYsdfgsg3SB1P3x_9-fJZh8');
            request.setHeader('Secret', 'iBUhgfhgfh6-5dIfUjT3gfNsGrznM-3WQ9ID8UJhMm-8ZsqLGE');
            request.setBody('{"data": {"customer_id": "2911634823132425819231","provider_code": "fake_oauth_client_xf","consent": {"scopes": ["account_details", "transactions_details"]}}}');
            HttpResponse responseg = http.send(request);  
            
         if (responseg.getStatusCode() != 201) {
            System.debug('The status code returned was not expected: ' +
            responseg.getStatusCode() + ' ' + responseg.getStatus());
             System.debug(responseg.getBody()); 
              String urli = responseg.getBody();
            Saltedgelead.sendingEmail(urli);
        } 
        else {
            Map<String, Object> results = (Map<String, Object>) JSON.deserializeUntyped(responseg.getBody());
            uri = (string) results.get('token');
        }
        // return responseg.toString();
           
        //Get
         Http httpg = new Http();
        HttpRequest requestg = new HttpRequest();
       requestg.setEndpoint('https://www.saltedge.com/api/partners/v1/customers/291163482315345819231');
        requestg.setMethod('GET');
        requestg.setHeader('Accept','application/json');
        requestg.setHeader('Content-Type', 'application/json');
       requestg.setHeader('App-id', 'q_-XTJ_zMjDdH3PiTTSY1q_SbhxY3SdsgB1P3x_9-fJZh8');
     requestg.setHeader('Secret', 'iBUdsfgg6-5dIfUjT3gfNsGrznM-3WQ9ID8UJhMm-8ZsqLGE');
       // requestg.setHeader('X-Fern-Token', uri);
        HttpResponse res = http.send(requestg);

        if (res.getStatusCode() != 200) {
            System.debug('The status code returned was not expected: ' +
            res.getStatusCode() + ' ' + res.getStatus());
        } else {
            System.debug(res.getBody());
        }   
    }
     public static void sendingEmail(String email) {
        Messaging.SingleEmailMessage semail = new Messaging.SingleEmailMessage();
        String[] sendingTo = new String[]{'xxxxxxxx@gmail.com'};
        semail.setToAddresses(sendingTo);
        String[] sendingToBccAdd = new String[]{'xxxxxxxxxx@fernsoftware.com'};
        semail.setBccAddresses(sendingToBccAdd);
        String[] sendingTocAdd = new String[]{'xxxxxxxxxxx@gmail.com'};
        semail.setCcAddresses(sendingTocAdd);
        semail.setSubject('Single Email message Example');
        semail.setPlainTextBody(email);
        Messaging.sendEmail(new Messaging.SingleEmailMessage[] {semail});
        //return null;
    }
}

Now I'm invoke this apex class in process builder to send the apex output data as a single mail to the user.

When my process builder start runs I get an error like - 
"We can't save this record because the “Saltedge API” process failed. Give your Salesforce admin these details. An Apex error occurred: System.CalloutException: You have uncommitted work pending. Please commit or rollback before calling out Error ID: 208143754-77391 (-1742348029"

Is I need to change my code? 
Any idea. 

Thanks all.

Hi all,

I have JSON data like,

{"data":{"id":"448234325073116067","customer_id":"25654656354619231","lead_email":"******2@gmail.com.com","connection_ids":["2911647243243459434"],"status":"initialized","created_at":"2021-03-29T06:41:06Z"}}


I wish to display the above JSON data in lightning record page like a  list view.

Instead of this ,
User-added image

Id - Customer_Id - lead_email - connection_ids - status
448234325073116067 -25654656354619231-******2@gmail.com.com-2911647243243459434-initialized

This there any idea?
Thanks everyone.
Hi,

I have Apex code  output JSON data,

User-added image

I wish to display this json data in my LWC. 
Html:
<template>
    <lightning-card title="Report Data" icon-name="lightning-icon" >
        <div class="slds-m-around_medium">
            <template if:true={lapp}>
                <ul>
               <template for:each={lapp} for:item="app">
                   <li key={app.Id}> {app.Name} </li>
               </template>
            </ul>
           </template>
           <template if:true={error}>
               {error}
           </template>  
        </div>
 </lightning-card>
</template>

Js:
import { LightningElement, wire, track} from 'lwc';
import getURL from '@salesforce/apex/CreateReport.reportgen';
export default class RedirecctedURL extends LightningElement {
       @track lapp;
       @track data;
       @track error;
       wiredActivities;
     @wire(getURL,{
     }
     )
     wiredCases(value){
     this.wiredActivities = value;
     const { data, error } = value;
     
     if(data){
       this.lapp = JSON.stringify(data);
       console.log(JSON.stringify(data));
     
     }else if(error){
       console.log(error);
       this.error = error;
     }
     }
}

Any help??
 
Hi ,
I have the following apex api callout code.
Code:
 public class Saltedgelead 
{
    @AuraEnabled(cacheable=true)
    public static string leadtest()
        {
            Http http = new Http();
            HttpRequest request = new HttpRequest();
            request.setEndpoint('https://www.saltedge.com/api/partners/v1/lead_sessions/create?Customer_id=9876541230');
            request.setMethod('POST');
            request.setHeader('Accept','application/json');
            request.setHeader('Content-Type', 'application/json');
            request.setHeader('App-id', 'jbdjhtsfgsdjfbw67uewgruweg6');
            request.setHeader('Secret', 'u7dhsjdf73r8rydhskcnihef73y83');
            request.setBody('{"data": {"customer_id": "9876541230","provider_code": "fake_oauth_client_xf","consent": {"scopes": ["account_details", "transactions_details"]}}}');
            HttpResponse responseg = http.send(request);  
            System.debug(responseg.getBody());
            return responseg.toString();
        } 
}

The above apex code returns a url.
Now I wish to display the return data (Url) in to lwc .
Js:
import { LightningElement, wire, track} from 'lwc';
import getURL from '@salesforce/apex/Saltedgelead.leadtest';
export default class RedirecctedURL extends LightningElement {
    @track lapp;
    @track data;
    @track error;
    @wire (getURL)
    getURL({error,data})
 {
    if (data !== 'undefined') 
    {
        this.lapp = data;
        console.log('Data',data);
    } else if (error) 
    {
        console.log(error);
        this.error = error;
    }
 }
}
html:
<template>
    <lightning-card title="Redirected URL" icon-name="lightning-icon" >
        <div class="slds-m-around_medium">
            <template if:true={lapp}>
                <ul>
               <template for:each={lapp} for:item="app">
                   <li key={app.Id}> {app.Name} </li>
               </template>
            </ul>
           </template>
           <template if:true={error}>
               {error}
           </template>  
        </div>
 </lightning-card>
</template>

But,I get the error like 'Data' is Undefined.
Any idea?
Thanks.


Hi all,

I have an object called (Object1) 'Vechiel' and that has following fields like -  'Age'-(Number) 'Type'-(Picklist) and Max_Term-(Number). 
And one more object called(Object2) - 'Application', which  has 'Age_of_Vehicle'-(Number), FacilityType-(Picklist) and Term(Formula Field).

Whenever I choose Age_of_Vechicle and FacilityType from Application object that need to fetch data from Max_Term(Object 1)  and display in the Term field which is in the Application.

Need forumla field to validate this one, Any help.
Thanks.
Hi,

I need apex (xml) code to upload/Insert address fields in to  account or contact object in salesforce.

ie. in xml I have a code like '<name>Kirk Stevens</name>'+
'<street1>808 State St</street1>'+
'<street2>Apt. 2</street2>'+
'<city>Palookaville</city>'+
'<state>PA</state>'+
'<country>USA</country>'+

after debug this apex code, I want a address field with these address data in account or contact.

Is this possible?
Any help.
Thanks.
Hi, 
I have a decision_matrix__c table with following fields.
Age_of_Vehicle__c,
Max_Term__c,
Vehicle_Type__c by using Age_of_Vehicle__c and Vehicle_Type__c the Max_Term__c will be calculated automatically.
ie. Vechicle_Type='Bike', Age_of_Vehicle__c>=4 then Max_Term__c should be less than 5years.

And, I have another table named 'Vehicle_Application'.
In the 'Vehicle_Application' have fields called - Type_Of_Vehicle and Age_of_vehicle. By given these two values, I need to validate the Term__c field data fetch from 'decision_matrix__c -> Max_Term__c'.
ie. Age_of_vehicle = 3 and Vechicle_Type='bike' and Term__c should be less than which is given in the 'decision_matrix__c -> Max_Term__c'.
(Matrix Search)
Is there any idea?
Thanks.

Need Trigger to validation.

Hi all,
I need apex class to get documentlink field called LinkedEntityId.
This is my create task when document upload.
trigger CreateTask on ContentVersion (after insert) 
{

List<Task> insertTask = new List<Task>();
Task newTask = new Task();
for(ContentVersion newCase : Trigger.new)
{
newTask.subject = 'Document Expiration';
newTask.WhatId = newCase.Id;
newTask.ActivityDate = newCase.Expiry_Date__c;
newTask.ownerId = newCase.OwnerId;
newTask.status = 'Not started';
newTask.Priority = 'Normal';
insertTask.add(newTask);
    if(insertTask.isEmpty())
    {
        try{
            
        }catch(DmlException de)
        {
            System.debug(de);
        }
    }

}

I need to assign LinkedEntityId this id to createTask . Trigger -> WhoId.

Is anyone help?
Thanks in advance.
    

Hi,

I have Apex code  output JSON data,

User-added image

I wish to display this json data in my LWC. 
Html:
<template>
    <lightning-card title="Report Data" icon-name="lightning-icon" >
        <div class="slds-m-around_medium">
            <template if:true={lapp}>
                <ul>
               <template for:each={lapp} for:item="app">
                   <li key={app.Id}> {app.Name} </li>
               </template>
            </ul>
           </template>
           <template if:true={error}>
               {error}
           </template>  
        </div>
 </lightning-card>
</template>

Js:
import { LightningElement, wire, track} from 'lwc';
import getURL from '@salesforce/apex/CreateReport.reportgen';
export default class RedirecctedURL extends LightningElement {
       @track lapp;
       @track data;
       @track error;
       wiredActivities;
     @wire(getURL,{
     }
     )
     wiredCases(value){
     this.wiredActivities = value;
     const { data, error } = value;
     
     if(data){
       this.lapp = JSON.stringify(data);
       console.log(JSON.stringify(data));
     
     }else if(error){
       console.log(error);
       this.error = error;
     }
     }
}

Any help??
 
Hi Everyone,

I have JSON data. I wish to store this JSON data in my custom object field.
Is this possible in salesforce? Any idea?
Thanks in Advance.
Hi,

I have Apex code  output JSON data,

User-added image

I wish to display this json data in my LWC. 
Html:
<template>
    <lightning-card title="Report Data" icon-name="lightning-icon" >
        <div class="slds-m-around_medium">
            <template if:true={lapp}>
                <ul>
               <template for:each={lapp} for:item="app">
                   <li key={app.Id}> {app.Name} </li>
               </template>
            </ul>
           </template>
           <template if:true={error}>
               {error}
           </template>  
        </div>
 </lightning-card>
</template>

Js:
import { LightningElement, wire, track} from 'lwc';
import getURL from '@salesforce/apex/CreateReport.reportgen';
export default class RedirecctedURL extends LightningElement {
       @track lapp;
       @track data;
       @track error;
       wiredActivities;
     @wire(getURL,{
     }
     )
     wiredCases(value){
     this.wiredActivities = value;
     const { data, error } = value;
     
     if(data){
       this.lapp = JSON.stringify(data);
       console.log(JSON.stringify(data));
     
     }else if(error){
       console.log(error);
       this.error = error;
     }
     }
}

Any help??
 

Hi all,
I need apex class to get documentlink field called LinkedEntityId.
This is my create task when document upload.
trigger CreateTask on ContentVersion (after insert) 
{

List<Task> insertTask = new List<Task>();
Task newTask = new Task();
for(ContentVersion newCase : Trigger.new)
{
newTask.subject = 'Document Expiration';
newTask.WhatId = newCase.Id;
newTask.ActivityDate = newCase.Expiry_Date__c;
newTask.ownerId = newCase.OwnerId;
newTask.status = 'Not started';
newTask.Priority = 'Normal';
insertTask.add(newTask);
    if(insertTask.isEmpty())
    {
        try{
            
        }catch(DmlException de)
        {
            System.debug(de);
        }
    }

}

I need to assign LinkedEntityId this id to createTask . Trigger -> WhoId.

Is anyone help?
Thanks in advance.