• Darshan Gandhi 9
  • NEWBIE
  • 0 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 5
    Replies
HI,
How to write test class for the below code. Please help me on this.
 
public class BIIB_ADU_ManageConsent_Controller{
    static Id recordTypeId = BIIB_Utility_Class.getRecordTypeId(BIIB_Adu_Constant.CONSENT_OBJECT, BIIB_Adu_Constant.CONSENT_RECORDTYPE );
    
    /**
* Method Name :     getConsentManagement
* @author:
* @description:     Aura Method to get consent management record 

**/
    @AuraEnabled
    public static List<BIIB_Consent_Management__c> getConsentManagement(){
        //Map<String,BIIB_Consent_Management__c> mapConsent = new Map<String,BIIB_Consent_Management__c>();
        User us = [Select id, accountId from User where Id = :UserInfo.getUserId()];
        List<BIIB_Consent_Management__c> consentList = new List<BIIB_Consent_Management__c>();
        system.debug ('User name' + us);
        ID AccountId = us.accountID;
        System.debug ('account name ' + AccountId );
        consentList= [SELECT ID,BIIB_Consent_Type__c,BIIB_SignatureFirstName__c,BIIB_SignatureLastName__c,BIIB_Status__c,BIIB_Effective_Date__c,CreatedDate 
                      FROM BIIB_Consent_Management__c WHERE 
                      BIIB_Patient_Account__c =: AccountId AND
                      BIIB_Status__c = :BIIB_Adu_Constant.CONSENT_STATUS AND
                      BIIB_Consent_Flag__c = true AND
                      RecordTypeId = :recordTypeId AND
                      (BIIB_Consent_Type__c = :BIIB_Adu_Constant.CONSENT_TYPE_HIPAA OR
                       BIIB_Consent_Type__c = :BIIB_Adu_Constant.CONSENT_TYPE_PATIENTSERVICES) 
                     LIMIT 2];
        
        Map<String,BIIB_Consent_Management__c> mapConsent = new Map<String,BIIB_Consent_Management__c>();
        for(BIIB_Consent_Management__c cm:consentList){
            mapConsent.put(cm.BIIB_Consent_Type__c,cm);
        }
        if(!mapConsent.containsKey(BIIB_Adu_Constant.CONSENT_TYPE_HIPAA)){
            consentList.add(new BIIB_Consent_Management__c(BIIB_Consent_Type__c=BIIB_Adu_Constant.CONSENT_TYPE_HIPAA));
        }
        if(!mapConsent.containsKey(BIIB_Adu_Constant.CONSENT_TYPE_PATIENTSERVICES)){
            consentList.add(new BIIB_Consent_Management__c(BIIB_Consent_Type__c=BIIB_Adu_Constant.CONSENT_TYPE_PATIENTSERVICES));
        }
        return consentList;
    }
    
    
}

 
Hi all,

I'm hoping for some attention from the Lightning team, but would appreciate any light anyone could shed on this.

We have a customer who has added a custom lookup field to the Opportunity object, pointing to Contact, with a lookup-filter criterion that permits only contacts related to the opportunity's parent account. The standard "new" page, when editing the custom relation, correctly shows a 2-item list containing one appropriate contact and a "new contact" item:
User-added image

Meanwhile, we have a "new" Lightning override page that uses lightning:inputField inside a lightning:recordEditForm, and the relationship field doesn't seem to work correctly: it shows only a "recently used contacts" list that does not include the only Contact conforming to the lookup-filter criterion, and shows other ones instead:
User-added image

If the user starts typing to find a contact and uses the "search" list item to activate the advanced search window, the list still shows only irrelevancies. Even if one of these incorrect records is selected, the user is prevented from saving the record because pre-save validation notices that the record violates the lookup-filter criterion:
User-added image

In short, this really looks to us like a boolean-inversion bug in the code for the lists, presumably in an SOQL WHERE clause (or equivalent) that retrieves candidate contacts to populate it.

best regards,
Jim
My lex component
<aura:component implements="flexipage:availableForRecordHome,force:hasRecordId">
   <lightning:button label="PDF" onclick ="{!c.handleClick}"/>
   <aura:attribute name="recordId" type="String"/> 
</aura:component>

controller:

({
	handleClick : function(component, event, helper) {
        
        var recId = component.get('v.recordId');
        var retURL = component.get('v.pdf');
        retURL = window.open("apex/TTDLetter?recordId="+recordID);
        	
	}
})

when i have clicked on the lightning button from record page I got a error 'URL doesn't exist".
Our organization currently uses OnClick Javascript custom buttons for most of our tasks (phonecalls, contact management, events, etc.), and looking to the future and potential of Salesforce Lightning, we would like to begin the migration process, however we need replacements for our buttons. I've been browsing around on the forums here for a few days and it seems like people have has sucess using visualforce pages, flows, and lightning component ui:buttons, so I'm curious as to which one might be the best choice for our organization, and also what the differences between them are. We are looking for one that functions and codes similarly to the classic Javascript buttons. 

As an example, here is the code to one of our buttons. This code is for our "in progress" button, which is clicked whenever a contact is being called during an event, and the click removes the contact from the call list so that the person is not called twice or at the same time.

/* This code allows the javascript to access the API and push data into the Org.*/ 
{!requireScript("/soap/ajax/10.0/connection.js")}; 
sforce.connection.session = "{!$Api.Session_ID}"; 

function updateTask( ) 

try 

var task = new sforce.SObject("Task"); 
task.Id = "{!Task.Id}"; 
task.Status = "In Progress"; 
task.OwnerId = "{!User.Id}"; 
var result = sforce.connection.update([task]); 
if (result[0].getBoolean("success") == false ) { 
alert(result[0].errors.message); 
return; 

window.top.location.href=window.top.location.href; 

catch (e) { 
alert(e); 
}


updateTask();

If I was to rewrite this as a visualforce page, flow, or lightning component ui:button, how would I go about that? Any help is greatly appreciated. Thank you.