• Tanu
  • NEWBIE
  • 10 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 15
    Questions
  • 12
    Replies
here is a class - can anyone help me to explain the functionality of this apex class so that i can write test class for it..


public with sharing class CuAp_ContractDebtTransferCtrlr {
    private static final String CLASS_NAME = 'CuAp_ContractDebtTransferCtrlr';
    private static final String DEBUG = '[' + CLASS_NAME + '] ';
    private static final List<String> transferReasonField = new List<string>{ GlUt_APIConstantsBillTransfer.TRANSFERREASONAPINAME};
        
    private static final List<String> contractFields = new List<string>{ 
       GlUt_APIConstantsContracts.CONTRACTNAMEAPINAME,
       GlUt_APIConstantsContracts.BILLINGADDRESSAPINAME,
       GlUt_APIConstantsContracts.CONTRACTBALANCEAPINAME
    };
        
    private static final List<String> billCalculationFields = new List<string>{ 
       GlUt_APIConstantsBillCalculation.STATUSAPINAME
    };
                    
        
    @AuraEnabled
    public static List<List<GlAp_FieldProps>> retrieveTransferReasonDetails() {
        List<List<GlAp_FieldProps>> twoColFormattedList = new List<List<GlAp_FieldProps>>();
        try {
            List<GLAp_FieldProps> transferReasonFieldProps = new List<GLAp_FieldProps>();
            transferReasonFieldProps = GlAp_LightningDataAccess.getObjectsFieldProperties(GlUt_APIConstantsBillTransfer.BILLTRANSFERAPINAME, transferReasonField);
            for(integer i=0; i < transferReasonFieldProps.size(); i = i+2){
                List<GlAp_FieldProps> lstEntry = new List<GlAp_FieldProps>();
                integer secondEntryIndex = i+1;
                lstEntry.add(transferReasonFieldProps[i]);
                if(secondEntryIndex < transferReasonFieldProps.size()){
                    lstEntry.add(transferReasonFieldProps[secondEntryIndex]);
                }
                twoColFormattedList.add(lstEntry);
            }
        } catch (exception e) {
            GlUt_Logger.logException(e);
        }
        finally {
            GlUt_Logger.writeLogsToDatabase();
        }
        return twoColFormattedList;
    }
    
    @AuraEnabled
    public static List<List<GlAp_FieldProps>> retrieveContractFieldDetails() {
        List<List<GlAp_FieldProps>> twoColFormattedList = new List<List<GlAp_FieldProps>>();
        // Get the field properties for the Location object
        List<GLAp_FieldProps> contractProperties = new List<GLAp_FieldProps>();
        try {
            contractProperties = GlAp_LightningDataAccess.getObjectsFieldProperties(GlUt_APIConstantsContracts.CONTRACTAPINAME, contractFields);
     
            GlAp_FieldProps objFieldProp1 = new GlAp_FieldProps(true, false, true, false, CuAp_Constants.AMOUNTTOTRANSFER,CuAp_Constants.AMOUNTTOTRANSFERLABEL,
                                                               'number', false, false, GlUt_APIConstantsContracts.CONTRACTAPINAME);

            contractProperties.add(objFieldProp1);
            
            for(GlAp_FieldProps fieldProp : contractProperties ){
                if (fieldProp.fieldName == GlUt_APIConstantsContracts.CONTRACTBALANCEAPINAME )
                    fieldProp.fieldLabel = LoAp_Constants.DEBTAMOUNTLABEL;
                
                fieldProp.showLabel = true;
            }
            
            for(integer i=0; i < contractProperties.size(); i = i+2){
                List<GlAp_FieldProps> lstEntry = new List<GlAp_FieldProps>();
                integer secondEntryIndex = i+1;
                lstEntry.add(contractProperties[i]);
                if(secondEntryIndex < contractProperties.size()){
                    lstEntry.add(contractProperties[secondEntryIndex]);
                }
                twoColFormattedList.add(lstEntry);
            }
        } catch (exception e) {
            GlUt_Logger.logException(e);
        }
        finally {
            GlUt_Logger.writeLogsToDatabase();
        }
        return twoColFormattedList;
    }
    
    @AuraEnabled
    public static BillingContract__c retrieveContractDetails(String ContractId) {
        BillingContract__c objBillingContract ;
        if(string.isNotBlank(ContractId)){
            objBillingContract = (BillingContract__c)GlAp_LightningDataAccess.getRecord(GlUt_APIConstantsContracts.CONTRACTAPINAME,
                                                                                        ContractId,contractFields);
        }
        return objBillingContract;
    }
    
    @AuraEnabled
    public static string transferDebts(String contractFromTransferID, String contractToTransferID, String transferReason, String amountToTransfer, string billCalculationId) {
        String responseCode;
        CuAp_BillTransferObject objBTData = new CuAp_BillTransferObject();
        objBTData.BillTransfers = new List<CuAp_BillTransferObject.BillTransfers>();
        
        CuAp_BillTransferObject.BillTransfers objBillTransfer = new CuAp_BillTransferObject.BillTransfers(contractToTransferID,contractFromTransferID,
                                                                                                          transferReason,amountToTransfer,billCalculationId);
        objBTData.BillTransfers.add(objBillTransfer);
        String JSONPayload = JSON.serialize(objBTData);
        try{
            HttpResponse response = BlUt_HerokuWebservices.makeCallout(BlUt_HerokuWebservices.DEBT_TRANSFER, 2000, 'application/json', JSONPayload, 'PUT');
            // handle response
            if (response.getStatusCode() == 200) {
                if(billCalculationId != null ){
                    BillCalculation__c objBillCalculation = (BillCalculation__c)GlAp_LightningDataAccess.getRecord(GlUt_APIConstantsBillCalculation.BILLCALCULATIONAPINAME,
                                                                                        billCalculationId,billCalculationFields);
                    
                    objBillCalculation.Status__c = Label.BlIn_BillCalculationStatusPending;
                    objBillCalculation  = (BillCalculation__c) GlUt_FieldSecurity.cleanseFields(objBillCalculation, false);
                    update objBillCalculation;
                }
                responseCode = Label.GlUt_OK;
            }
            else {
                throw new AuraHandledException(Label.BlAp_BillCalcRequestError + response.getStatus());
            }
        }
        catch (exception e) {
            GlUt_Logger.logException(e);
            throw new AuraHandledException(e.getMessage());
        }
        finally {
            GlUt_Logger.writeLogsToDatabase();
        }
        return responseCode;
    }
    
    @AuraEnabled
    public static Id createBillCalculation(string contractId){
        BillCalculation__c billCalculationObj = GlUt_BillCalculationUtilities.createBillCalculation(contractId,Label.GlUt_Transfer,Label.BlIn_BillCalculationStatusNew);
        return billCalculationObj.Id;
    }
    
    
    public class DebtTransferContainerWrapper{
        @AuraEnabled
        public List<List<GlAp_FieldProps>> transferReasonList;
        @AuraEnabled
        public List<List<GlAp_FieldProps>> billingContractFieldList;
        @AuraEnabled
        public BillingContract__c billingContractObj;
        @AuraEnabled
        public String  billingAddressFormatted;
        
        public DebtTransferContainerWrapper(){
              this.transferReasonList = new List<List<GlAp_FieldProps>>();
              this.billingContractFieldList = new List<List<GlAp_FieldProps>>();
              this.billingContractObj = new BillingContract__c();
          }
    }
   
    @AuraEnabled
    public static DebtTransferContainerWrapper getInfoToDisplay(string billingContractRecordId) {
        DebtTransferContainerWrapper objWrapper = new DebtTransferContainerWrapper();
        if(billingContractRecordId != null ){
            objWrapper.transferReasonList = retrieveTransferReasonDetails();
            objWrapper.billingContractFieldList = retrieveContractFieldDetails();
            objWrapper.billingContractObj = retrieveContractDetails(billingContractRecordId);
            objWrapper.billingAddressFormatted =   retrieveContractDetails(billingContractRecordId).BillingAddress__c.replace('<br>', '\r\n');
        }
        return objWrapper;
    }
}
  • October 03, 2019
  • Like
  • 0
i want to create an approval process which will be invoked by process builder on creation of record -- if start date >= today, then record should be auto approved. If start date < today then it should go to manager for approval.

Can anyone suggest me approval process entry criteria and actions for this.
 
  • October 03, 2019
  • Like
  • 0
Hi All,
I have created a lookup field named "oap" on opportunity. Now i need to calculate the total amount of those opportunities which is associated with a particular oap. could you please help me writing a trigger for this as i am new to apex.

Thank you.
Regards
Tanu
  • September 14, 2017
  • Like
  • 0
Hi All,

I have created a lookup relationship between opportunity and oap__c..  now i want to calculate sum(amount) of all those opportunities which is linked with a particular oap. I created the lookup field OAP on opportunity. As per my understanding this cant be done through configuration.

Could you please help how can i acheive this.?? I am new to apex trigger pls help.

Thanks
Tanu
  • September 03, 2017
  • Like
  • 0
I have created a custom object named oap. and created a look up field named oap id on opportunity. Also, there is one more custom field on opty named "revenue type"(its a picklist having value a,b,c). Now i want whenever user create or edit an opportunity, then it will restict user to select unique oap id if revenue type is "a".  if revenue type is b or c, user can enter the duplicate oap id.  Could you please help how to achive this?

Thanks 
Tanu
  • August 29, 2017
  • Like
  • 0
One of my user is able to see those opportunities which is created by the user who is not added under him in role hierarchy. And user is having to view his own records and records created by those who are added under him. also, i have not created any sharing rule to five extra access to view others records. Could you please let me know what mistake i m doing? i dont want my users to view any others team members records. 

Please sugegst.. Thanks !!

Regards
Tanu
  • August 24, 2017
  • Like
  • 0
Hi All,

I want to export the list of all accounts on which we Won any opportunity in past “2 years“ but no opportunity got created in past “3 months”. 

Please help.

Thanks
Tanu
  • August 04, 2017
  • Like
  • 0
Hi All,

I have created an alert which triggers whenever an opportunity got created. Recipient receives this alert from opportunity owner. However, alert should be sent from a particular email id. eg. tpg.communication@domain.com.

how can i achieve this ? your sugesstions are really welcome. 

Thank You

Regards
Tanu
  • July 25, 2017
  • Like
  • 0
Hi All,

Being an admin, I am using my same username in sandbox and production. If i update another user's username, I am getting error that Username already exist. Even i have checked in sandbox, my all users are having different username.

Could you please suggest how can i update their username on production. 

Thanks
Tanu
  • July 04, 2017
  • Like
  • 0
I have a field on Opportunity object named "Type__c"(picklist) having values: opportunity ,Lead. When sales stage of a record having Type = “Lead”, is changed from Opportunity Identified to higher stage then Type should be updated to “Opportunity” and below message needs to be displayed on opportunity.   

Message to display: As deal moved to later stage, this lead will be auto-updated to opprtunity.

I have created field update for this but now stuck with this message. Could you please help and let me know how i can i populate this message whenever type is updated to lead.  

Your help is highly appreciated.

Thanks
Tanu


 
  • June 28, 2017
  • Like
  • 0
Hi all, 

I have a requirement that an alert should be triggered whenever no changes has been made on opportunity for 90 days.That alert needs to be received by opportunity owner in "to" and owner's manager in "CC". i have created the workflow rule now facing problem with email alert.

So i created a custom manager field which will pick the email id of manager. so how can i add that custom field in CC??
would request you to let me know how can i achive this.

Kind Regards,
Tanu
 
  • May 05, 2017
  • Like
  • 0
Hi,

I have created a dashboard with filters to view the oppportunity pipeIine. and  filter named"Geo" having values Americas,europe,india and apac.
now when i select americas, then europe and india's opportunities are also getting displayed in dashboard. on selection of another geo, its works fine. Facing problem in americas filter only.   Please suggest.!!

Thanks

 
  • May 04, 2017
  • Like
  • 0
Hi All,
I need to insert records in custom object in which one fiild having lookup relation ship with user. while using workbench i am getting error in sales person feild. i. e sales person: Id Value Of Incorrect Type.  Please let me know what mistake  i am doing??
Below are the details for object and fielde in which data needs to be inserted.
Object name :  OAP__c
Fields: Sales person (Lookup {User})
           Billing Type : Text

Thanks 
Tanu
  • February 12, 2017
  • Like
  • 0
After installing salesforce for outlook, When i click on setting in system tray icon, a pop comes named salesforce for outlook settings. but when i select URL from dropdown, it shows blank screen.. ideally it should ask me to enter username and password..  Could you please let me know if i am missing  anything...please find the below screenshot... Thanks!!

User-added image


 
  • February 05, 2017
  • Like
  • 0
Hi All,
Please let me know if is there any workaround to achieve below requirement:
I have created a picklist field ABC(having values Y and N) and formula field "stage change duration". now my requiremnt is if stage change duration >45 days then ABC should get updated as N.

I created a timebased workflow but it works with newly created opportunities. my main target is to update existing opportunities in which stage change duration> 45 days.

Any suggestions??
Thanks




 
  • December 10, 2016
  • Like
  • 0
Hi All,
I have created a lookup field named "oap" on opportunity. Now i need to calculate the total amount of those opportunities which is associated with a particular oap. could you please help me writing a trigger for this as i am new to apex.

Thank you.
Regards
Tanu
  • September 14, 2017
  • Like
  • 0
Hi All,

I have created an alert which triggers whenever an opportunity got created. Recipient receives this alert from opportunity owner. However, alert should be sent from a particular email id. eg. tpg.communication@domain.com.

how can i achieve this ? your sugesstions are really welcome. 

Thank You

Regards
Tanu
  • July 25, 2017
  • Like
  • 0
Hi All,

Being an admin, I am using my same username in sandbox and production. If i update another user's username, I am getting error that Username already exist. Even i have checked in sandbox, my all users are having different username.

Could you please suggest how can i update their username on production. 

Thanks
Tanu
  • July 04, 2017
  • Like
  • 0
I have a field on Opportunity object named "Type__c"(picklist) having values: opportunity ,Lead. When sales stage of a record having Type = “Lead”, is changed from Opportunity Identified to higher stage then Type should be updated to “Opportunity” and below message needs to be displayed on opportunity.   

Message to display: As deal moved to later stage, this lead will be auto-updated to opprtunity.

I have created field update for this but now stuck with this message. Could you please help and let me know how i can i populate this message whenever type is updated to lead.  

Your help is highly appreciated.

Thanks
Tanu


 
  • June 28, 2017
  • Like
  • 0
Hi All,
I need to insert records in custom object in which one fiild having lookup relation ship with user. while using workbench i am getting error in sales person feild. i. e sales person: Id Value Of Incorrect Type.  Please let me know what mistake  i am doing??
Below are the details for object and fielde in which data needs to be inserted.
Object name :  OAP__c
Fields: Sales person (Lookup {User})
           Billing Type : Text

Thanks 
Tanu
  • February 12, 2017
  • Like
  • 0
After installing salesforce for outlook, When i click on setting in system tray icon, a pop comes named salesforce for outlook settings. but when i select URL from dropdown, it shows blank screen.. ideally it should ask me to enter username and password..  Could you please let me know if i am missing  anything...please find the below screenshot... Thanks!!

User-added image


 
  • February 05, 2017
  • Like
  • 0
Hi All,
Please let me know if is there any workaround to achieve below requirement:
I have created a picklist field ABC(having values Y and N) and formula field "stage change duration". now my requiremnt is if stage change duration >45 days then ABC should get updated as N.

I created a timebased workflow but it works with newly created opportunities. my main target is to update existing opportunities in which stage change duration> 45 days.

Any suggestions??
Thanks




 
  • December 10, 2016
  • Like
  • 0