• Anonymous Developer
  • NEWBIE
  • 160 Points
  • Member since 2021

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 36
    Questions
  • 63
    Replies
Hello everyone I'm seeking assistance in developing a controller for my Lightning Web Component (LWC). I aim to implement comprehensive control over file uploads, including the capability to manage both uploads and deletions of the uploaded files. Below, you'll find the relevant code for reference.Your guidance and expertise on this matter would be greatly appreciated. Thank you. 

HTML
<template>
    <div class="container">
        <p style="display:none">{recipientId}</p>
        <p style="display:none">{staticFileName}</p>
        <p style="display:none">{agreementLabel}</p>
        <p style="display:none">{documentUploadRequired}</p>

        <div class="buttons-section">
            <lightning-button 
                label={downloadButtonLabel} 
                onclick={handleDownload}
            ></lightning-button>
        </div>

        <div class="read-only-card">
            <object 
                data={pdfUrl} 
                title="Static Resource" 
                type="application/pdf" 
                width="100%" 
                height="100%"
            ></object>
        </div>

        <div class="file-upload-section">
            <lightning-file-upload
                accept=".pdf"
                onuploadfinished={handleUploadFinished}
                disabled={isDocumentUploaded}
                required
                record-id={recordId}
            ></lightning-file-upload>
        </div>

        <div class="checkbox-section">
            <lightning-input 
                type="checkbox" 
                label={agreementLabel}
                checked={isAgreementChecked}
                onchange={handleAgreementChange} 
                disabled={isDocumentUploaded}
            ></lightning-input>
        </div>

        <div class="buttons-section">
            <lightning-button 
                label={submitButtonLabel} 
                onclick={handleAcknowledge}
                disabled={isButtonDisabled} 
            ></lightning-button>
        </div>
    </div>
</template>

Javascript
import { LightningElement, api, track } from 'lwc';
import { FlowNavigationNextEvent, FlowNavigationBackEvent, FlowNavigationFinishEvent } from 'lightning/flowSupport';

export default class aS_AcknowledgeDocumentLWC extends LightningElement {

    @api recipientId;
    @api staticFileName;
    @api agreementLabel;
    @api documentUploadRequired;
    @api documentUploadLabel;
    @api loadingMessage;
    @api submitButtonLabel;
    @api downloadButtonLabel;
    @api fileName;

    

    @track selectedFile;
    @track isAgreementChecked = false;
    @track isDocumentUploaded = false;



    get pdfUrl() {
        const url = `/resource/${this.fileName}`;
        console.log('PDF URL:', url);
        return url;
    }

    get isButtonDisabled(){
        return !this.isAgreementChecked || this.isDocumentUploaded;
    }
    
    removeFile() {
        const fileUpload = this.template.querySelector('lightning-file-upload');
        fileUpload.clear();
        this.isDocumentUploaded = false;
    }

    handleAgreementChange(event) {
        this.isAgreementChecked = event.target.checked;//checkbox interaction
    }

    handleDocumentUpload() {    
        if (!this.selectedFile) { // check if file is selected
            this.showToast('Error', 'Please select a file.', 'error');
            return;
        }
    
        this.loadingMessage = 'Uploading document...'; // show loading message
    
        const formData = new FormData(); // create formData object to prepare for file upload
        formData.append('document', this.selectedFile);
    
        handleUpload({ formData })// send file to server for upload using apex
            .then(result => {
                this.isDocumentUploaded = true; // Set to true after successful upload
                this.loadingMessage = ''; // Clear loading message
                    if (result.startsWith('Error')) {
                        console.error(result);
                    } else {
                        console.log('File uploaded successfully:', result);
                    }
            })
            .catch(error => { // handle any errors that occur during the upload
                console.error('Error uploading document', error);
                this.loadingMessage = ''; // clear loading message
                this.showToast('Error', 'An error occurred while uploading the document.', 'error');
            });
    }
    

    handleAcknowledge() {
        this.dispatchEvent(new FlowNavigationNextEvent());
    }

    handleDownload() { // Construct the URL to download the PDF document
        const pdfFileName = this.fileName;
        const pdfUrl = `/resource/${pdfFileName}`;

        const anchor = document.createElement('a'); // craete an anchor element to trigger the download
        anchor.href = pdfUrl;
        anchor.download = pdfFileName;
    
        anchor.click(); // trigger the download
    }
    
    handleUploadFinished(event) {
        const uploadedFiles = event.detail.files;
        if (uploadedFiles.length > 0) {
            this.uploadedFileName = uploadedFiles[0].name;
            this.isDocumentUploaded = true;
        } 
    }
    
    
}

need help with the code. THanks in advance.
Hello everyone, I kindly request assistance in developing a Lightning Web Component that resembles a formal document, displaying a curated collection of manually uploaded static resources in Salesforce. Your expertise and guidance in this matter would be greatly appreciated.

Hello Good day everyone I have a question about the list 

 

I have a custom object application that has two lookup fields for accounts and has multiple related contacts on each account I want to filter all the records on the custom objects to only show the records to the contacts related to the accounts is this possible to implement if so can anyone help me?

 

Thanks in advance

This is the FlowUser-added imageand this is how it runs

Loop CollaborationGroupMemberRequest Status = Pending
Get Account Where ContactId = $Record>UserId>ContactId
Get MembershipGroup Where Group_Id__c contains Loop CollaborationGroup Id
If Account Type Contains MembershipGroup Type{
Id = Loop CollaborationGroupMemberRequest Id 
update Status = Accepted
}else{
create Task update ActivityDate to CurrentDate
}


the bold ones are the objects while the italics are the fields.


Thanks in advance
 
This is my code:
 
public without sharing class AS_TriggerQuoteEvent {

    @InvocableMethod( label = 'Trigger Quote')

    public static void triggerQuoteEvent(List<Request> requestList) {
        system.debug('requestList >>' +requestList);

        for(Request req : requestList){
            if ( req.event != null ){
                Database.update ( req.event );
            } else {
                Database.update ( req.events );
            }
        }
    }

    public class Request {

        @InvocableVariable( label = 'Events')
        public List<sObject> events;
        
        @InvocableVariable( label = 'Event')
        public sObject event;
    }
}

Thanks in Advance
This is my code
 
public without sharing class AS_GroupDatatableSourceCollection {

    @InvocableMethod(label = 'Groups Action')
    public static List<Response> getResults( List<Request> parserInput ) {


        // My Group
        List<Id> myGroupIds                     = new List<Id>();
        List<CollaborationGroupMember> cgmList  = [SELECT CollaborationGroupId FROM CollaborationGroupMember WHERE MemberId = :parserInput[0].user_id];
        for ( CollaborationGroupMember cgm : cgmList ) {
            myGroupIds.add(cgm.CollaborationGroupId);
        }
        system.debug('myGroupIds>>>' +myGroupIds);
        // Public
        
        List<Id> publicGroupIds                 = new List<Id>();
        for ( CollaborationGroup cg : [SELECT Id FROM CollaborationGroup WHERE CollaborationType = 'Public' AND Id NOT IN :myGroupIds] ) {
            publicGroupIds.add(cg.Id);
        }

        system.debug('publicGroupIds>>>' +publicGroupIds);
        // Same Type Groups
        List<AS_Membership_Groups__c> listmg    = Database.query('SELECT Id, Name, AS_Type__c, AS_Group_Id__c, AS_Paid__c, AS_Status__c FROM AS_Membership_Groups__c WHERE AS_Type__c INCLUDES (\''+ parserInput[0].type +'\')');
        List<Id> collabGroupsFromMG             = new List<Id>();
        // For eacgh membership groups, parse and store all into a single collection
        for (AS_Membership_Groups__c mg : listmg) {
            
            if ( ! String.isBlank( mg.AS_Group_Id__c ) ) {

                collabGroupsFromMG.addAll( mg.AS_Group_Id__c.split(',') );
            }
        }

        List<Id> myGroupTypeIds                 = new List<Id>();
        for ( CollaborationGroup cg : [SELECT Id FROM CollaborationGroup WHERE Id IN :collabGroupsFromMG AND Id NOT IN :myGroupIds] ) {
            myGroupTypeIds.add(cg.Id);
        }
        system.debug('myGroupTypeIds>>>' +myGroupTypeIds);


        Response res                            = new Response();
        res.myGroups                            = myGroupIds;
        res.eligibleGroups                      = myGroupTypeIds;
        res.publicGroups                        = publicGroupIds;

        List<Response> resList                  = new List<Response>();
        resList.add(res);

        return resList;
    }
        

    public class Request {

        @InvocableVariable
        public String type;
        
        @InvocableVariable
        public String user_id;

    }

    public class Response {
        @InvocableVariable
        public List<Id> myGroups;
        
        @InvocableVariable
        public List<Id> eligibleGroups;

        @InvocableVariable
        public List<Id> publicGroups;

        @InvocableVariable
        public List<String> parsedCollectionOfStrings;
    }
}

Thanks in advance
Here's my code:
<template>
    <div class="business-days-container">
        <h4 class="header">{flowLabel}<abbr class="slds-required" hidden={required}>* </abbr></h4>
        <template if:false={readonly}>
            <div class="day-wrap slds-grid slds-wrap slds-gutter">
                <div class="day slds lds-col slds-size_1-of-1 slds-small-size_1-of-1 slds-medium-size_12-of-12 slds-large-size_3-of-12">Monday</div>
                <div class="day-time slds-col slds-size_1-of-1 slds-small-size_1-of-1 slds-medium-size_12-of-12 slds-large-size_9-of-12 inline-flex-wrap">
                    <lightning-input onchange={handleTimeChange} class="flex-item" read-only={readonly} type="time" variant="label-hidden" name="monday_in"  placeholder="HH:MM" label="" value={mondayVal.open}></lightning-input>
                    <span class="flex-item span-item"> to </span>
                    <lightning-input onchange={handleTimeChange} class="flex-item" read-only={readonly} type="time" variant="label-hidden" name="monday_out" placeholder="HH:MM" label="" value={mondayVal.close}></lightning-input>
                </div>
            </div>
            <div class="day-wrap slds-grid slds-wrap slds-gutter">
                <div class="day slds-col slds-size_1-of-1 slds-small-size_1-of-1 slds-medium-size_12-of-12 slds-large-size_3-of-12">Tuesday</div>
                <div class="day-time slds-col slds-size_1-of-1 slds-small-size_1-of-1 slds-medium-size_12-of-12 slds-large-size_9-of-12 inline-flex-wrap">
                    <lightning-input onchange={handleTimeChange} class="flex-item" read-only={readonly} type="time" variant="label-hidden" name="tuesday_in"  placeholder="HH:MM" label="" value={tuesdayVal.open}></lightning-input>
                    <span class="flex-item span-item"> to </span>
                    <lightning-input onchange={handleTimeChange} class="flex-item" read-only={readonly} type="time" variant="label-hidden" name="tuesday_out" placeholder="HH:MM" label="" value={tuesdayVal.close}></lightning-input>
                </div>
            </div>
            <div class="day-wrap slds-grid slds-wrap slds-gutter">
                <div class="day slds-col slds-size_1-of-1 slds-small-size_1-of-1 slds-medium-size_12-of-12 slds-large-size_3-of-12">Wednesday</div>
                <div class="day-time slds-col slds-size_1-of-1 slds-small-size_1-of-1 slds-medium-size_12-of-12 slds-large-size_9-of-12 inline-flex-wrap">
                    <lightning-input onchange={handleTimeChange} class="flex-item" read-only={readonly} type="time" variant="label-hidden" name="wednesday_in"  placeholder="HH:MM"  label="" value={wednesdayVal.open}></lightning-input>
                    <span class="flex-item span-item"> to </span>
                    <lightning-input onchange={handleTimeChange} class="flex-item" read-only={readonly} type="time" variant="label-hidden" name="wednesday_out" placeholder="HH:MM" label="" value={wednesdayVal.close}></lightning-input>
                </div>
            </div>
            <div class="day-wrap slds-grid slds-wrap slds-gutter">
                <div class="day slds-col slds-size_1-of-1 slds-small-size_1-of-1 slds-medium-size_12-of-12 slds-large-size_3-of-12">Thursday</div>
                <div class="day-time slds-col slds-size_1-of-1 slds-small-size_1-of-1 slds-medium-size_12-of-12 slds-large-size_9-of-12 inline-flex-wrap">
                    <lightning-input onchange={handleTimeChange} class="flex-item" read-only={readonly} type="time" variant="label-hidden" name="thursday_in"  placeholder="HH:MM" label="" value={thursdayVal.open}></lightning-input>
                    <span class="flex-item span-item"> to </span>
                    <lightning-input onchange={handleTimeChange} class="flex-item" read-only={readonly} type="time" variant="label-hidden" name="thursday_out" placeholder="HH:MM" label="" value={thursdayVal.close}></lightning-input>
                </div>
            </div>
            <div class="day-wrap slds-grid slds-wrap slds-gutter">
                <div class="day slds-col slds-size_1-of-1 slds-small-size_1-of-1 slds-medium-size_12-of-12 slds-large-size_3-of-12">Friday</div>
                <div class="day-time slds-col slds-size_1-of-1 slds-small-size_1-of-1 slds-medium-size_12-of-12 slds-large-size_9-of-12 inline-flex-wrap">
                    <lightning-input onchange={handleTimeChange} class="flex-item" read-only={readonly} type="time" variant="label-hidden" name="friday_in"  placeholder="HH:MM" label="" value={fridayVal.open}></lightning-input>
                    <span class="flex-item span-item"> to </span>
                    <lightning-input onchange={handleTimeChange} class="flex-item" read-only={readonly} type="time" variant="label-hidden" name="friday_out" placeholder="HH:MM" label="" value={fridayVal.close}></lightning-input>
                </div>
            </div>
            <div class="day-wrap slds-grid slds-wrap slds-gutter">
                <div class="day slds-col slds-size_1-of-1 slds-small-size_1-of-1 slds-medium-size_12-of-12 slds-large-size_3-of-12">Saturday</div>
                <div class="day-time slds-col slds-size_1-of-1 slds-small-size_1-of-1 slds-medium-size_12-of-12 slds-large-size_9-of-12 inline-flex-wrap">
                    <lightning-input onchange={handleTimeChange} class="flex-item" read-only={readonly} type="time" variant="label-hidden" name="saturday_in"  placeholder="HH:MM" label="" value={saturdayVal.open}></lightning-input>
                    <span class="flex-item span-item"> to </span>
                    <lightning-input onchange={handleTimeChange} class="flex-item" read-only={readonly} type="time" variant="label-hidden" name="saturday_out" placeholder="HH:MM"  label="" value={saturdayVal.close}></lightning-input>
                </div>
            </div>
            <div class="day-wrap slds-grid slds-wrap slds-gutter">
                <div class="day slds-col slds-size_1-of-1 slds-small-size_1-of-1 slds-medium-size_12-of-12 slds-large-size_3-of-12">Sunday</div>
                <div class="day-time slds-col slds-size_1-of-1 slds-small-size_1-of-1 slds-medium-size_12-of-12 slds-large-size_9-of-12 inline-flex-wrap">
                    <lightning-input onchange={handleTimeChange} class="flex-item" read-only={readonly} type="time" variant="label-hidden" name="sunday_in"  placeholder="HH:MM" label="" value={sundayVal.open}></lightning-input>
                    <span class="flex-item span-item"> to </span>
                    <lightning-input onchange={handleTimeChange} class="flex-item" read-only={readonly} type="time" variant="label-hidden" name="sunday_out" placeholder="HH:MM"  label="" value={sundayVal.close}></lightning-input>
                </div>
            </div>
        </template>
<template if:true={readonly}>
            <div class="day-wrap slds-grid slds-wrap slds-gutter">
                <div class="slds-col slds-small-size_1-of-1 slds-medium-size_12-of-12 slds-large-size_1-of-3">Monday</div>
                <div class="slds-col slds-small-size_1-of-1 slds-medium-size_12-of-12 slds-large-size_2-of-3 inline-flex-wrap">
                    <template if:true={mondayClosed}>
                        <span class="flex-item span-item view-only">Close</span>
                    </template>
<template if:false={mondayClosed}>
                        <span class="span-item view-only uppercased">{mondayVal.open}</span>
                        <span class="flex-item span-item view-only">to</span>
                        <span class="span-item view-only uppercased">{mondayVal.close}</span>
                    </template>
</div>
</div>
<div class="day-wrap slds-grid slds-wrap slds-gutter">
    <div class="slds-col slds-small-size_1-of-1 slds-medium-size_12-of-12 slds-large-size_1-of-3">Tuesday</div>
    <div class="slds-col slds-small-size_1-of-1 slds-medium-size_12-of-12 slds-large-size_1-of-3 inline-flex-wrap">
        <template if:true={tuesdayClosed}>
                        <span class="flex-item span-item view-only">Close</span>
                    </template>
        <template if:false={tuesdayClosed}>
                        <span class="span-item view-only uppercased">{tuesdayVal.open}</span>
                        <span class="flex-item span-item view-only">to</span>
                        <span class="span-item view-only uppercased">{tuesdayVal.close}</span>
                    </template>
    </div>
</div>
<div class="day-wrap slds-grid slds-wrap slds-gutter">
    <div class="slds-col slds-small-size_1-of-1 slds-medium-size_12-of-12 slds-large-size_1-of-3">Wednesday</div>
    <div class="slds-col slds-small-size_1-of-1 slds-medium-size_12-of-12 slds-large-size_1-of-3 inline-flex-wrap">
        <template if:true={wednesdayClosed}>
                        <span class="flex-item span-item view-only">Close</span>
                    </template>
        <template if:false={wednesdayClosed}>
                        <span class="span-item view-only uppercased">{wednesdayVal.open}</span>
                        <span class="flex-item span-item view-only">to</span>
                        <span class="span-item view-only uppercased">{wednesdayVal.close}</span>
                    </template>
    </div>
</div>
<div class="day-wrap slds-grid slds-wrap slds-gutter">
    <div class="slds slds-size_1-of-3">Thursday</div>
    <div class="slds-col slds-size_1-of-1 slds-small-size_1-of-1 slds-medium-size_12-of-12 slds-large-size_6-of-12 inline-flex-wrap">
        <template if:true={thursdayClosed}>
                        <span class="flex-item span-item view-only">Close</span>
                    </template>
        <template if:false={thursdayClosed}>
                        <span class="span-item view-only uppercased">{thursdayVal.open}</span>
                        <span class="flex-item span-item view-only">to</span>
                        <span class="span-item view-only uppercased">{thursdayVal.close}</span>
                    </template>
    </div>
</div>
<div class="day-wrap slds-grid slds-wrap slds-gutter">
    <div class="slds slds-size_1-of-3">Friday</div>
    <div class="slds-col slds-size_1-of-1 slds-small-size_1-of-1 slds-medium-size_12-of-12 slds-large-size_6-of-12 inline-flex-wrap">
        <template if:true={fridayClosed}>
                        <span class="flex-item span-item view-only">Close</span>
                    </template>
        <template if:false={fridayClosed}>
                        <span class="span-item view-only uppercased">{fridayVal.open}</span>
                        <span class="flex-item span-item view-only">to</span>
                        <span class="span-item view-only uppercased">{fridayVal.close}</span>
                    </template>
    </div>
</div>
<div class="day-wrap slds-grid slds-wrap slds-gutter">
    <div class="slds slds-size_1-of-3">Saturday</div>
    <div class="slds-col slds-size_1-of-1 slds-small-size_1-of-1 slds-medium-size_12-of-12 slds-large-size_6-of-12 inline-flex-wrap">
        <template if:true={saturdayClosed}>
                        <span class="flex-item span-item view-only">Close</span>
                    </template>
        <template if:false={saturdayClosed}>
                        <span class="span-item view-only uppercased">{saturdayVal.open}</span>
                        <span class="flex-item span-item view-only">to</span>
                        <span class="span-item view-only uppercased">{saturdayVal.close}</span>
                    </template>
    </div>
</div>
<div class="day-wrap slds-grid slds-wrap slds-gutter">
    <div class="slds slds-size_1-of-3">Sunday</div>
    <div class="slds-col slds-size_1-of-1 slds-small-size_1-of-1 slds-medium-size_12-of-12 slds-large-size_6-of-12 inline-flex-wrap">
        <template if:true={sundayClosed}>
                        <span class="flex-item span-item view-only">Close</span>
                    </template>
        <template if:false={sundayClosed}>
                        <span class="span-item view-only uppercased">{sundayVal.open}</span>
                        <span class="flex-item span-item view-only">to</span>
                        <span class="span-item view-only uppercased">{sundayVal.close}</span>
                    </template>
    </div>
</div>
</template>
</div>
</template>
User-added imageIf I were to put a value on Monday like the picture above I want the field beside it to be required if I were to push the proceed button which was not included in the screenshot. The same goes for the other days. The solution should go both ways if I were to put the value on the next dropbox the other field should be required as well. How do I do this?

Need Help. Thanks in advance

In a Digital Experience site: Administration > Login & Registration > Password Pages > Reset Password.

I'm able to choose between "Default Page" and "Visualforce Page".
Rather than building a brand new Visualforce page from scratch

The URL path is /_ui/system/security/ChangePassword.

This is a screenshot of the default page.
User-added image

The timestamp is wrong even though all Default Time Zone is set to (GMT+11:00) Australian Eastern Daylight Time (Australia/Sydney) but it always stamps the wrong time. It would've been correct if it was pm. What do I do to change this is there any workaround? 

the time I tested it is around 1:48 pm.
 
Thanks in advance.

Here's my code:
 
public class AS_UnlockProgramEngagement {
    @InvocableMethod (label = 'Unlock Program Engagement Record'
                      description = 'Unlock Program Engagement Object'
                      category = 'Program Engagement')
    public static void unlockProgramEngagementRecord (){
        List<pmdm__ProgramEngagement__c> brokerageList = [SELECT Id FROM pmdm__ProgramEngagement__c LIMIT 10]; // Get records to unlock
        List<pmdm__ProgramEngagement__c> lockList = new List <pmdm__ProgramEngagement__c>(); // Check locked records
        for(pmdm__ProgramEngagement__c b: brokerageList){
            if(Approval.isLocked(b.id)){
                lockList.add(b);
            }
        }
        if(!lockList.isEmpty()){ // Unlocks Record
            List<Approval.UnlockResult> unlockResultList = Approval.unlock(lockList, false);
            for(Approval.UnlockResult unlockResult : unlockResultList){
                if(unlockResult.isSuccess()){ // Get processed Id of the record
                    system.debug('Successfuly unlocked Brokerage Request' + unlockResult.getId());
                }
                else
                { 
                    for(Database.Error err : unlockResult.getErrors()){ // Get all errors
                        System.debug('The following error has occured.');
                        System.debug(err.getStatusCode() +' : ' + err.getMessage());
                        System.debug('Brokerage Request field that affected this error: ' +err.getFields());
                        // System.debug('Total Quotes Unlocked in the Execution : ' + unlockResultList.size());
                    }         
                }
            }
        }
    }
}


Thanks.
 

Here's my code

public class AS_UnlockApproval {

    @InvocableMethod (label = 'Unlock Record Brokerage Request' description = 'Unlock Brokerage Request Object' category = 'Brokerage Request')
    public static List<Response> Unlock(List<Request> requests) {
        List<Response> responseWrapper= new List<Response>();
        
        for (Request i:  requests) { 
            String recordId = i.recordId;
            
            Approval.UnlockResult unlockResult = Approval.unlock(recordId);

            Response response = new Response();
            
            response.isSuccess = unlockResult.isSuccess();
            response.errors = packErrorString(unlockResult);

            responseWrapper.add(response);
            
        }
        return responseWrapper;
    
    }

    public static String packErrorString(Approval.UnlockResult unlockResult) {
        String errorString = '';
        for(Database.Error err : unlockResult.getErrors()) {
            errorString = errorString + (' The following error has occurred.');                   
            errorString = errorString + (' ' + err.getStatusCode() + ': ' + err.getMessage());
        }
        return errorString;

    }


    public class InvocableErrorException extends Exception{}

    public class Request {

      @InvocableVariable
      public String recordId;
      
    }
    
    public class Response {
     
       @invocableVariable
        public Boolean isSuccess; 
        
        @invocableVariable
        public String errors;
    }
    public class InvocableActionException extends Exception {}
}

I already enabled the process automation on record locking and unlocking.

User-added image
Am I missing something?

I just need to unlock the approval process automatedly since it's not editable. Need Help. Thanks.

Here's my code
global class AS_UpdateContactFromStagingObject implements Database.Batchable<sObject> {

    global Database.QueryLocator start(Database.BatchableContext BC){

        String query = 'SELECT AS_Contact_Id__c, AS_Pronouns__c, AS_Aboriginal_or_Torres_Strait_Islander__c, AS_Date_of_Birth__c, AS_CALD__c, AS_Vaccination_status__c, AS_Require_an_interpreter__c, AS_TIS_Interpreter_Language_Required__c, AS_Safe_to_use_this_phone_number__c, AS_Is_it_safe_to_use_this_email_address__c, AS_Can_a_voicemail_be_left__c, AS_Street__c, AS_City__c, AS_State_Province__c, AS_Zip_Postal_Code__c, AS_Country__c, AS_Why_is_this_their_current_location__c, AS_Agency_Referral__c, AS_Contact_Updated__c FROM Contact_Staging__c WHERE AS_Agency_Referral__c = True AND AS_Contact_Updated__c = False AND AS_Contact_Id__c != null';
        return Database.getQueryLocator(query);

    }
    global void execute(Database.BatchableContext BC, List<Contact_Staging__c> batch) {

        System.debug('batch=='+batch);
        
        
        List<Id> conList = new List<Id>();
        
        for(Contact_Staging__c a : batch){
            conList.add(a.AS_Contact_Id__c);
        }
        
        Map<Id, Contact> mapcontact = new Map<Id, Contact>();
        List<Contact> contacList = new List<Contact>();
        
        for( Contact mapcon: [SELECT Id,caseman__Pronouns__c,AS_Aboriginal_or_Torres_Strait_Islander__c,Birthdate,AS_CALD__c,AS_Vaccination_status__c,
                              AS_TIS_Interpreter_Language_Required__c,AS_Safe_to_use_this_phone_number__c,AS_Is_it_safe_to_use_this_email_address__c,
                              AS_Can_a_voicemail_be_left__c,MailingStreet,MailingCity,MailingState,MailingPostalCode,MailingCountry,AS_Why_is_this_their_current_location__c
                              FROM Contact WHERE Id IN :conList]){
                                  System.debug('mapcon==' + mapcon);
                                  mapcontact.put(mapcon.Id, mapcon);
                              }
		System.debug('mapcontact==' + mapcontact);
        
        for(Contact_Staging__c constage : batch){
            Contact conTemp = mapcontact.get(constage.AS_Contact_Id__c);
            
            if(constage.AS_Pronouns__c != null){
                conTemp.caseman__Pronouns__c = constage.AS_Pronouns__c;
            }
            if(constage.AS_Aboriginal_or_Torres_Strait_Islander__c != null){
                conTemp.AS_Aboriginal_or_Torres_Strait_Islander__c = constage.AS_Aboriginal_or_Torres_Strait_Islander__c;
            }
            if(constage.AS_Date_of_Birth__c != null){
                conTemp.Birthdate = constage.AS_Date_of_Birth__c;
            }
            if(constage.AS_CALD__c != null){
                conTemp.AS_CALD__c = constage.AS_CALD__c;
            }
            if(constage.AS_Vaccination_status__c != null){
                conTemp.AS_Vaccination_status__c = constage.AS_Vaccination_status__c;
            }
            if(constage.AS_TIS_Interpreter_Language_Required__c != null){
                conTemp.AS_TIS_Interpreter_Language_Required__c = constage.AS_TIS_Interpreter_Language_Required__c;
            }
            if(constage.AS_Safe_to_use_this_phone_number__c != null){
                conTemp.AS_Safe_to_use_this_phone_number__c = constage.AS_Safe_to_use_this_phone_number__c;
            }
            if(constage.AS_Is_it_safe_to_use_this_email_address__c != null){
                conTemp.AS_Is_it_safe_to_use_this_email_address__c = constage.AS_Is_it_safe_to_use_this_email_address__c;
            }
            if(constage.AS_Can_a_voicemail_be_left__c != null){
                conTemp.AS_Can_a_voicemail_be_left__c = constage.AS_Can_a_voicemail_be_left__c;
            }
            if(constage.AS_Street__c != null){
                conTemp.MailingStreet = constage.AS_Street__c;
            }
            if(constage.AS_City__c != null){
                conTemp.MailingCity = constage.AS_City__c;
            }
            if(constage.AS_State_Province__c != null){
                conTemp.MailingState = constage.AS_State_Province__c;
            }
            if(constage.AS_Zip_Postal_Code__c != null){
                conTemp.MailingPostalCode = constage.AS_Zip_Postal_Code__c;
            }
            if(constage.AS_Country__c != null){
                conTemp.MailingCountry = constage.AS_Country__c;
            }
            if(constage.AS_Why_is_this_their_current_location__c != null){
                conTemp.AS_Why_is_this_their_current_location__c = constage.AS_Why_is_this_their_current_location__c;
            }
            contacList.add(conTemp);
        }
        
        update contacList;
    }

    global void finish(Database.BatchableContext BC){

    }
}

Thanks.

Fields on contact staging:

Contact_Id__c,
Aboriginal_or_Torres_Strait_Islander__c, (checkbox)
Date_of_Birth__c, (date)
Vaccination_status__c, (picklist)
Agency_Referral__c (checkbox)
Contact_Updated__c  (checkbox)

 

the logic I am referring to is this i don't know if it makes sense.
 

Contact Staging List batch > List Contact Ids

Map<Id, Contact> idConMap = new Map <Id, Contact>
List contact toBeUpdated;

for ( Contact con : [Select Id, fields here FROM Contact WHERE Id in :listContIds] ) {
    idConMap.put( con.Id, con );
}

for ( Contact Staging a : batch ) {
    Contact mapCont = idConMap.get(a.ContactId__c);

    if ( a.field != null ) {
        mapCont.field = a.field;
    }

    toBeUpdated.add( mapCont );
}

update toBeUpdated;
I want to get all the records where Agency Referral is True
And Contact Updated = False. Need Help Thanks

I have a field in contact staging object which are 

  • AS_Date_of_Birth__c (Date)
  • AS_Vaccination_status__c (Picklist)

when the record on contact staging is created I want the fields on contact staging to update the same fields located in contact object.

 

Can anyone help me? Thanks.

How do I map Contact Id to contact staging object contact Id field?

Need help creating a scheduled batch class here is my code.

APEX CLASS:

global class AS_UpdateContactFromStagingObject implements Database.Batchable<sObject> {

    global Database.QueryLocator start(Database.BatchableContext BC){

        String query = 'SELECT AS_Contact_Id__c, AS_Date_of_Birth__c, AS_Vaccination_status__c , AS_Safe_to_use_this_phone_number__c, AS_State_Province__c FROM Contact_Staging__c WHERE AS_Agency_Referral__c = True AND AS_Contact_Updated__c = False';
        return Database.getQueryLocator(query);

    }
    global void execute(Database.BatchableContext BC, List<Contact_Staging__c> batch) {
        System.debug('batch=='+batch);

        List<Contact_Staging__c> conList = new List<Contact_Staging__c>();
        for(Contact_Staging__c a : batch){
            a.AS_Contact_Updated__c = true;
            conList.add(a);
        }


        update conList;

    }
    global void finish(Database.BatchableContext BC){

    }

}

Scheduler:
global class AS_UpdateContactFromStagingSchedulable implements Schedulable {
    public static String sched = '0 00 00 * * ?'; 

    global static String scheduleBatch() {

        AS_UpdateContactFromStagingSchedulable SC = new AS_UpdateContactFromStagingSchedulable(); 

        return System.schedule('Update Contact Records', sched, SC);

    }

    global void execute(SchedulableContext sc) {

        AS_UpdateContactFromStagingObject batch = new AS_UpdateContactFromStagingObject();
        Database.executeBatch(batch, 50);
 

    }

}

so the logic is when you create a new contact stage the contact Id must be an existing Id on contact. the update happens when the contact staging record is created and the batch is running.
 
if the fields on contact staging are not equal to null it updates and if the fields are null nothing will happen. does that make sense? Need Help. Thanks
 

Fields on contact staging

Contact_Id__c,
Pronouns__c
Aboriginal_or_Torres_Strait_Islander__c, 
Date_of_Birth__c,
CALD__c,
Vaccination_status__c,
Require_an_interpreter__c, 
TIS_Interpreter_Language_Required__c, Safe_to_use_this_phone_number__c, 
Is_it_safe_to_use_this_email_address__c, Can_a_voicemail_be_left__c,
Street__c, 
City__c,
State_Province__c
Zip_Postal_Code__c
Country__c,
Why_is_this_their_current_location__c, 
Agency_Referral__c
Contact_Updated__c 

 

Need help to create a batch class for this the logic is to get all records on contact staging Then update the contact records base on the record info so in the photo below is the record needed to be created on contact staging and the contact Id is the same on contact the fields that are updated on contact staging will happen on contacts aswell


User-added image


did it make sense? Need Help. Thanks

I want to create a batch that can update the contact details if it found a contact record
 
  • the batch will update the contact record
  • will only update the record once
This is my code:


global class AS_UpdateContactFromStagingObject implements Database.Batchable<sObject> {
    global Database.QueryLocator start(Database.BatchableContext BC){
        String query = 'SELECT AS_Contact_Id__c, AS_Pronouns__c, AS_Aboriginal_or_Torres_Strait_Islander__c, AS_Date_of_Birth__c, AS_CALD__c, AS_Vaccination_status__c, AS_Require_an_interpreter__c,   AS_TIS_Interpreter_Language_Required__c, AS_Safe_to_use_this_phone_number__c, AS_Is_it_safe_to_use_this_email_address__c, AS_Can_a_voicemail_be_left__c, AS_Street__c, AS_City__c, AS_State_Province__c, AS_Zip_Postal_Code__c, AS_Country__c, AS_Why_is_this_their_current_location__c, AS_Agency_Referral__c, AS_Contact_Updated__c FROM Contact_Staging__c WHERE AS_Agency_Referral__c = True AND AS_Contact_Updated__c = False';
        return Database.getQueryLocator(query);
    }
    global void execute(Database.BatchableContext BC, List<Contact_Staging__c> batch) {
        System.debug('batch=='+batch);
        List<Contact_Staging__c> conList = new List<Contact_Staging__c>();
        for(Contact_Staging__c a : batch){
            a.AS_Contact_Id__c  = '';
            a.AS_Pronouns__c  = '';
            a.AS_Aboriginal_or_Torres_Strait_Islander__c = '';
            a.AS_Date_of_Birth__c = '';
            a.AS_CALD__c = '';
            a.AS_Vaccination_status__c = '';
            a.AS_Require_an_interpreter__c = '';
            a.AS_TIS_Interpreter_Language_Required__c = '';
            a.AS_Safe_to_use_this_phone_number__c = '';
            a.AS_Is_it_safe_to_use_this_email_address__c = '';
            a.AS_Can_a_voicemail_be_left__c = '';
            a.AS_Street__c = '';
            a.AS_City__c = '';
            a.AS_State_Province__c = '';
            a.AS_Zip_Postal_Code__c = '';
            a.AS_Country__c = '';
            a.AS_Why_is_this_their_current_location__c = '';
            a.AS_Agency_Referral__c = False;
            a.AS_Contact_Updated__c = True;
            conList.add(a);
        }
        update conList;
    }
    global void finish(Database.BatchableContext BC){
    }
}




 
So I want a batch that will update the contact record only once.
  • I want to get all the records where the field agency referral is true and the field contact update = false
  • I want to update contact records based on records info
  • and update contact update = false

This is the code that I have for now since I'm stuck and need help.

Apex class:

global class UpdateContactFromStagingObject implements Database.Batchable<sObject> {
    List<Contact> conList = new List<Contact>();
    global Database.QueryLocator start(Database.BatchableContext BC){

        String query = 'SELECT  AS_Contact_Id__c FROM Contact_Staging__c WHERE AS_Agency_Referral__c = True AND Contact_Updated__c = False';
        return Database.getQueryLocator(query);
    }
    global void execute(Database.BatchableContext BC, List<Contact> batch) {
        System.debug('batch=='+batch);
        Set<String> conId = new Set<String>();
        for(Contact_Staging__c a : batch){
            conId.add(a.AS_Contact_Id__c);
        }
    }
    global void finish(Database.BatchableContext BC){
       
    }
}

Scheduled Batch Class:

global class UpdateContactFromStagingObjectSchedulable implements Schedulable {
        
    public static String sched = '0 00 05 * * ?'; 

    global static String scheduleMe() {
        UpdateContactFromStagingObjectSchedulable SC = new UpdateContactFromStagingObjectSchedulable(); 

        return System.schedule('Update Contact Records', sched, SC);
    }

    global void execute(SchedulableContext sc) {
        UpdateContactFromStagingObject batch = new UpdateContactFromStagingObject();
        Database.executeBatch(batch, 200);
    }
}

Is there anything I need to add? Thanks.

Flow Process:

Screen Flow:
  • Subject: Text 
  • Date: Date
  • Type: Picklist
    • Meeting
    • Phone Call
  • Description: Rich Text Area


Once Submitted
  • Get the object  Engagement
  • Create Client Notes
  • Relate to the delivery object

Show Success Message
  • Client Note has been created successfully.
  • Show Close button
  • Refreshes the page when clicking on the close button.
Need Help on Advance Apex Specialist:


Product2New.vfp:
<apex:page standardcontroller="Product2" extensions="Product2Extension">
  <apex:sectionHeader title="New Product" subtitle="Add Inventory"/>
  <apex:pageMessages id="pageMessages"/>
  <apex:form id="form">
    <apex:actionRegion>
      <apex:pageBlock title="Existing Inventory" id="existingInv">
        <apex:chart data="{!Inventory}" width="600" height="400">
          <apex:axis type="Category" fields="name" position="left" title="Product Family"/>
          <apex:axis type="Numeric" fields="val" position="bottom" title="Quantity Remaining"/>
          <apex:barSeries axis="bottom" orientation="horizontal" xField="val" yField="name"/>
        </apex:chart>
      </apex:pageBlock>
      <apex:pageBlock title="New Products">
        <apex:pageBlockButtons location="top">
          <apex:commandButton action="{!save}" value="Save" reRender="existingInv, orderItemTable, pageMessages"/>
        </apex:pageBlockButtons>
        <apex:pageBlockButtons location="bottom">
          <apex:commandButton action="{!addRows}" value="Add" reRender="orderItemTable, pageMessages"/>
        </apex:pageBlockButtons>

        <apex:pageBlockTable value="{!productsToInsert}" var="p" id="orderItemTable">
          <apex:column headerValue="{!$ObjectType.Product2.Fields.Name.Label}">
            <apex:inputText value="{!p.productRecord.Name}"/>
          </apex:column>
          <apex:column headerValue="{!$ObjectType.Product2.Fields.Family.Label}">
            <apex:selectList value="{!p.productRecord.Family}" size="1" multiselect="false">
              <apex:selectOptions value="{!FamilyOptions}"></apex:selectOptions>
            </apex:selectList>
          </apex:column>
          <apex:column headerValue="{!$ObjectType.Product2.Fields.IsActive.Label}">
            <apex:inputField value="{!p.productRecord.isActive}"/>
          </apex:column>
          <apex:column headerValue="{!$ObjectType.PricebookEntry.Fields.UnitPrice.Label}">
            <apex:inputText value="{!p.pricebookEntryRecord.UnitPrice}"/>
          </apex:column>
          <apex:column headerValue="{!$ObjectType.Product2.Fields.Initial_Inventory__c.Label}">
            <apex:inputField value="{!p.productRecord.Initial_Inventory__c}"/>
          </apex:column>
        </apex:pageBlockTable>
      </apex:pageBlock>
    </apex:actionRegion>
  </apex:form>
</apex:page>

Product2Extensions.apxc:
public class Product2Extension {

  public List<ProductWrapper> productsToInsert {get; set;}

  public Product2Extension(ApexPages.StandardController controller){
    productsToInsert = new List<ProductWrapper>();
    AddRows();
  }

  public void AddRows(){
    for (Integer i=0; i<Constants.DEFAULT_ROWS; i++ ) {
      productsToInsert.add( new ProductWrapper() );
    }
  }

  public List<ChartHelper.ChartData> GetInventory(){
    return ChartHelper.GetInventory();
  }

  public List<SelectOption> GetFamilyOptions() {
    List<SelectOption> options = new List<SelectOption>();
    options.add(new SelectOption(Constants.SELECT_ONE, Constants.SELECT_ONE));
    for(PickListEntry eachPicklistValue : Constants.PRODUCT_FAMILY) {
      options.add(new SelectOption(eachPicklistValue.getValue(), eachPicklistValue.getLabel()));
    }
    return options;
  }

  public PageReference Save(){
    Savepoint sp = Database.setSavepoint();
    try {
      List<Product2> products = new List<Product2>();
      List<PricebookEntry> pbes = new List<PricebookEntry>();

      for (ProductWrapper prodwrapper : productsToInsert) {
        if(prodwrapper.productRecord != null && prodwrapper.pricebookEntryRecord != null) {
          if(prodwrapper.productRecord.Name != null && prodwrapper.productRecord.Family != null && constants.SELECT_ONE != prodwrapper.productRecord.Family && prodwrapper.productRecord.Initial_Inventory__c != null && prodwrapper.pricebookEntryRecord.UnitPrice != null) {
            products.add(prodwrapper.productRecord);
            PricebookEntry pbe = prodwrapper.pricebookEntryRecord;
            pbe.IsActive = true;
            pbe.Pricebook2Id = Constants.STANDARD_PRICEBOOK_ID;
            pbes.add(pbe);
          }
        }
      }

      insert products;

      for (integer i = 0; i < pbes.size(); i++) {
        pbes[i].Product2Id = products[i].Id;
      }
      insert pbes;

      //If successful clear the list and display an informational message
      apexPages.addMessage(new ApexPages.message(ApexPages.Severity.INFO,productsToInsert.size()+' Inserted'));
      productsToInsert.clear();         //Do not remove
      AddRows();        //Do not remove
    } catch (Exception e){
      Database.rollback(sp);
      apexPages.addMessage(new ApexPages.message(ApexPages.Severity.ERROR, Constants.ERROR_MESSAGE));
    }
    return null;
  }

  public class ProductWrapper {
    public Product2 productRecord {get; set;}
    public PriceBookEntry pricebookEntryRecord {get; set;}

    public ProductWrapper() {
      productRecord = new product2(Initial_Inventory__c =0);
      pricebookEntryRecord = new pricebookEntry(Unitprice=0.0);
    }
  }
}
 
Hello everyone, I kindly request assistance in developing a Lightning Web Component that resembles a formal document, displaying a curated collection of manually uploaded static resources in Salesforce. Your expertise and guidance in this matter would be greatly appreciated.

Hello Good day everyone I have a question about the list 

 

I have a custom object application that has two lookup fields for accounts and has multiple related contacts on each account I want to filter all the records on the custom objects to only show the records to the contacts related to the accounts is this possible to implement if so can anyone help me?

 

Thanks in advance

This is the FlowUser-added imageand this is how it runs

Loop CollaborationGroupMemberRequest Status = Pending
Get Account Where ContactId = $Record>UserId>ContactId
Get MembershipGroup Where Group_Id__c contains Loop CollaborationGroup Id
If Account Type Contains MembershipGroup Type{
Id = Loop CollaborationGroupMemberRequest Id 
update Status = Accepted
}else{
create Task update ActivityDate to CurrentDate
}


the bold ones are the objects while the italics are the fields.


Thanks in advance
 
This is my code:
 
public without sharing class AS_TriggerQuoteEvent {

    @InvocableMethod( label = 'Trigger Quote')

    public static void triggerQuoteEvent(List<Request> requestList) {
        system.debug('requestList >>' +requestList);

        for(Request req : requestList){
            if ( req.event != null ){
                Database.update ( req.event );
            } else {
                Database.update ( req.events );
            }
        }
    }

    public class Request {

        @InvocableVariable( label = 'Events')
        public List<sObject> events;
        
        @InvocableVariable( label = 'Event')
        public sObject event;
    }
}

Thanks in Advance
This is my code
 
public without sharing class AS_GroupDatatableSourceCollection {

    @InvocableMethod(label = 'Groups Action')
    public static List<Response> getResults( List<Request> parserInput ) {


        // My Group
        List<Id> myGroupIds                     = new List<Id>();
        List<CollaborationGroupMember> cgmList  = [SELECT CollaborationGroupId FROM CollaborationGroupMember WHERE MemberId = :parserInput[0].user_id];
        for ( CollaborationGroupMember cgm : cgmList ) {
            myGroupIds.add(cgm.CollaborationGroupId);
        }
        system.debug('myGroupIds>>>' +myGroupIds);
        // Public
        
        List<Id> publicGroupIds                 = new List<Id>();
        for ( CollaborationGroup cg : [SELECT Id FROM CollaborationGroup WHERE CollaborationType = 'Public' AND Id NOT IN :myGroupIds] ) {
            publicGroupIds.add(cg.Id);
        }

        system.debug('publicGroupIds>>>' +publicGroupIds);
        // Same Type Groups
        List<AS_Membership_Groups__c> listmg    = Database.query('SELECT Id, Name, AS_Type__c, AS_Group_Id__c, AS_Paid__c, AS_Status__c FROM AS_Membership_Groups__c WHERE AS_Type__c INCLUDES (\''+ parserInput[0].type +'\')');
        List<Id> collabGroupsFromMG             = new List<Id>();
        // For eacgh membership groups, parse and store all into a single collection
        for (AS_Membership_Groups__c mg : listmg) {
            
            if ( ! String.isBlank( mg.AS_Group_Id__c ) ) {

                collabGroupsFromMG.addAll( mg.AS_Group_Id__c.split(',') );
            }
        }

        List<Id> myGroupTypeIds                 = new List<Id>();
        for ( CollaborationGroup cg : [SELECT Id FROM CollaborationGroup WHERE Id IN :collabGroupsFromMG AND Id NOT IN :myGroupIds] ) {
            myGroupTypeIds.add(cg.Id);
        }
        system.debug('myGroupTypeIds>>>' +myGroupTypeIds);


        Response res                            = new Response();
        res.myGroups                            = myGroupIds;
        res.eligibleGroups                      = myGroupTypeIds;
        res.publicGroups                        = publicGroupIds;

        List<Response> resList                  = new List<Response>();
        resList.add(res);

        return resList;
    }
        

    public class Request {

        @InvocableVariable
        public String type;
        
        @InvocableVariable
        public String user_id;

    }

    public class Response {
        @InvocableVariable
        public List<Id> myGroups;
        
        @InvocableVariable
        public List<Id> eligibleGroups;

        @InvocableVariable
        public List<Id> publicGroups;

        @InvocableVariable
        public List<String> parsedCollectionOfStrings;
    }
}

Thanks in advance
Here's my code:
<template>
    <div class="business-days-container">
        <h4 class="header">{flowLabel}<abbr class="slds-required" hidden={required}>* </abbr></h4>
        <template if:false={readonly}>
            <div class="day-wrap slds-grid slds-wrap slds-gutter">
                <div class="day slds lds-col slds-size_1-of-1 slds-small-size_1-of-1 slds-medium-size_12-of-12 slds-large-size_3-of-12">Monday</div>
                <div class="day-time slds-col slds-size_1-of-1 slds-small-size_1-of-1 slds-medium-size_12-of-12 slds-large-size_9-of-12 inline-flex-wrap">
                    <lightning-input onchange={handleTimeChange} class="flex-item" read-only={readonly} type="time" variant="label-hidden" name="monday_in"  placeholder="HH:MM" label="" value={mondayVal.open}></lightning-input>
                    <span class="flex-item span-item"> to </span>
                    <lightning-input onchange={handleTimeChange} class="flex-item" read-only={readonly} type="time" variant="label-hidden" name="monday_out" placeholder="HH:MM" label="" value={mondayVal.close}></lightning-input>
                </div>
            </div>
            <div class="day-wrap slds-grid slds-wrap slds-gutter">
                <div class="day slds-col slds-size_1-of-1 slds-small-size_1-of-1 slds-medium-size_12-of-12 slds-large-size_3-of-12">Tuesday</div>
                <div class="day-time slds-col slds-size_1-of-1 slds-small-size_1-of-1 slds-medium-size_12-of-12 slds-large-size_9-of-12 inline-flex-wrap">
                    <lightning-input onchange={handleTimeChange} class="flex-item" read-only={readonly} type="time" variant="label-hidden" name="tuesday_in"  placeholder="HH:MM" label="" value={tuesdayVal.open}></lightning-input>
                    <span class="flex-item span-item"> to </span>
                    <lightning-input onchange={handleTimeChange} class="flex-item" read-only={readonly} type="time" variant="label-hidden" name="tuesday_out" placeholder="HH:MM" label="" value={tuesdayVal.close}></lightning-input>
                </div>
            </div>
            <div class="day-wrap slds-grid slds-wrap slds-gutter">
                <div class="day slds-col slds-size_1-of-1 slds-small-size_1-of-1 slds-medium-size_12-of-12 slds-large-size_3-of-12">Wednesday</div>
                <div class="day-time slds-col slds-size_1-of-1 slds-small-size_1-of-1 slds-medium-size_12-of-12 slds-large-size_9-of-12 inline-flex-wrap">
                    <lightning-input onchange={handleTimeChange} class="flex-item" read-only={readonly} type="time" variant="label-hidden" name="wednesday_in"  placeholder="HH:MM"  label="" value={wednesdayVal.open}></lightning-input>
                    <span class="flex-item span-item"> to </span>
                    <lightning-input onchange={handleTimeChange} class="flex-item" read-only={readonly} type="time" variant="label-hidden" name="wednesday_out" placeholder="HH:MM" label="" value={wednesdayVal.close}></lightning-input>
                </div>
            </div>
            <div class="day-wrap slds-grid slds-wrap slds-gutter">
                <div class="day slds-col slds-size_1-of-1 slds-small-size_1-of-1 slds-medium-size_12-of-12 slds-large-size_3-of-12">Thursday</div>
                <div class="day-time slds-col slds-size_1-of-1 slds-small-size_1-of-1 slds-medium-size_12-of-12 slds-large-size_9-of-12 inline-flex-wrap">
                    <lightning-input onchange={handleTimeChange} class="flex-item" read-only={readonly} type="time" variant="label-hidden" name="thursday_in"  placeholder="HH:MM" label="" value={thursdayVal.open}></lightning-input>
                    <span class="flex-item span-item"> to </span>
                    <lightning-input onchange={handleTimeChange} class="flex-item" read-only={readonly} type="time" variant="label-hidden" name="thursday_out" placeholder="HH:MM" label="" value={thursdayVal.close}></lightning-input>
                </div>
            </div>
            <div class="day-wrap slds-grid slds-wrap slds-gutter">
                <div class="day slds-col slds-size_1-of-1 slds-small-size_1-of-1 slds-medium-size_12-of-12 slds-large-size_3-of-12">Friday</div>
                <div class="day-time slds-col slds-size_1-of-1 slds-small-size_1-of-1 slds-medium-size_12-of-12 slds-large-size_9-of-12 inline-flex-wrap">
                    <lightning-input onchange={handleTimeChange} class="flex-item" read-only={readonly} type="time" variant="label-hidden" name="friday_in"  placeholder="HH:MM" label="" value={fridayVal.open}></lightning-input>
                    <span class="flex-item span-item"> to </span>
                    <lightning-input onchange={handleTimeChange} class="flex-item" read-only={readonly} type="time" variant="label-hidden" name="friday_out" placeholder="HH:MM" label="" value={fridayVal.close}></lightning-input>
                </div>
            </div>
            <div class="day-wrap slds-grid slds-wrap slds-gutter">
                <div class="day slds-col slds-size_1-of-1 slds-small-size_1-of-1 slds-medium-size_12-of-12 slds-large-size_3-of-12">Saturday</div>
                <div class="day-time slds-col slds-size_1-of-1 slds-small-size_1-of-1 slds-medium-size_12-of-12 slds-large-size_9-of-12 inline-flex-wrap">
                    <lightning-input onchange={handleTimeChange} class="flex-item" read-only={readonly} type="time" variant="label-hidden" name="saturday_in"  placeholder="HH:MM" label="" value={saturdayVal.open}></lightning-input>
                    <span class="flex-item span-item"> to </span>
                    <lightning-input onchange={handleTimeChange} class="flex-item" read-only={readonly} type="time" variant="label-hidden" name="saturday_out" placeholder="HH:MM"  label="" value={saturdayVal.close}></lightning-input>
                </div>
            </div>
            <div class="day-wrap slds-grid slds-wrap slds-gutter">
                <div class="day slds-col slds-size_1-of-1 slds-small-size_1-of-1 slds-medium-size_12-of-12 slds-large-size_3-of-12">Sunday</div>
                <div class="day-time slds-col slds-size_1-of-1 slds-small-size_1-of-1 slds-medium-size_12-of-12 slds-large-size_9-of-12 inline-flex-wrap">
                    <lightning-input onchange={handleTimeChange} class="flex-item" read-only={readonly} type="time" variant="label-hidden" name="sunday_in"  placeholder="HH:MM" label="" value={sundayVal.open}></lightning-input>
                    <span class="flex-item span-item"> to </span>
                    <lightning-input onchange={handleTimeChange} class="flex-item" read-only={readonly} type="time" variant="label-hidden" name="sunday_out" placeholder="HH:MM"  label="" value={sundayVal.close}></lightning-input>
                </div>
            </div>
        </template>
<template if:true={readonly}>
            <div class="day-wrap slds-grid slds-wrap slds-gutter">
                <div class="slds-col slds-small-size_1-of-1 slds-medium-size_12-of-12 slds-large-size_1-of-3">Monday</div>
                <div class="slds-col slds-small-size_1-of-1 slds-medium-size_12-of-12 slds-large-size_2-of-3 inline-flex-wrap">
                    <template if:true={mondayClosed}>
                        <span class="flex-item span-item view-only">Close</span>
                    </template>
<template if:false={mondayClosed}>
                        <span class="span-item view-only uppercased">{mondayVal.open}</span>
                        <span class="flex-item span-item view-only">to</span>
                        <span class="span-item view-only uppercased">{mondayVal.close}</span>
                    </template>
</div>
</div>
<div class="day-wrap slds-grid slds-wrap slds-gutter">
    <div class="slds-col slds-small-size_1-of-1 slds-medium-size_12-of-12 slds-large-size_1-of-3">Tuesday</div>
    <div class="slds-col slds-small-size_1-of-1 slds-medium-size_12-of-12 slds-large-size_1-of-3 inline-flex-wrap">
        <template if:true={tuesdayClosed}>
                        <span class="flex-item span-item view-only">Close</span>
                    </template>
        <template if:false={tuesdayClosed}>
                        <span class="span-item view-only uppercased">{tuesdayVal.open}</span>
                        <span class="flex-item span-item view-only">to</span>
                        <span class="span-item view-only uppercased">{tuesdayVal.close}</span>
                    </template>
    </div>
</div>
<div class="day-wrap slds-grid slds-wrap slds-gutter">
    <div class="slds-col slds-small-size_1-of-1 slds-medium-size_12-of-12 slds-large-size_1-of-3">Wednesday</div>
    <div class="slds-col slds-small-size_1-of-1 slds-medium-size_12-of-12 slds-large-size_1-of-3 inline-flex-wrap">
        <template if:true={wednesdayClosed}>
                        <span class="flex-item span-item view-only">Close</span>
                    </template>
        <template if:false={wednesdayClosed}>
                        <span class="span-item view-only uppercased">{wednesdayVal.open}</span>
                        <span class="flex-item span-item view-only">to</span>
                        <span class="span-item view-only uppercased">{wednesdayVal.close}</span>
                    </template>
    </div>
</div>
<div class="day-wrap slds-grid slds-wrap slds-gutter">
    <div class="slds slds-size_1-of-3">Thursday</div>
    <div class="slds-col slds-size_1-of-1 slds-small-size_1-of-1 slds-medium-size_12-of-12 slds-large-size_6-of-12 inline-flex-wrap">
        <template if:true={thursdayClosed}>
                        <span class="flex-item span-item view-only">Close</span>
                    </template>
        <template if:false={thursdayClosed}>
                        <span class="span-item view-only uppercased">{thursdayVal.open}</span>
                        <span class="flex-item span-item view-only">to</span>
                        <span class="span-item view-only uppercased">{thursdayVal.close}</span>
                    </template>
    </div>
</div>
<div class="day-wrap slds-grid slds-wrap slds-gutter">
    <div class="slds slds-size_1-of-3">Friday</div>
    <div class="slds-col slds-size_1-of-1 slds-small-size_1-of-1 slds-medium-size_12-of-12 slds-large-size_6-of-12 inline-flex-wrap">
        <template if:true={fridayClosed}>
                        <span class="flex-item span-item view-only">Close</span>
                    </template>
        <template if:false={fridayClosed}>
                        <span class="span-item view-only uppercased">{fridayVal.open}</span>
                        <span class="flex-item span-item view-only">to</span>
                        <span class="span-item view-only uppercased">{fridayVal.close}</span>
                    </template>
    </div>
</div>
<div class="day-wrap slds-grid slds-wrap slds-gutter">
    <div class="slds slds-size_1-of-3">Saturday</div>
    <div class="slds-col slds-size_1-of-1 slds-small-size_1-of-1 slds-medium-size_12-of-12 slds-large-size_6-of-12 inline-flex-wrap">
        <template if:true={saturdayClosed}>
                        <span class="flex-item span-item view-only">Close</span>
                    </template>
        <template if:false={saturdayClosed}>
                        <span class="span-item view-only uppercased">{saturdayVal.open}</span>
                        <span class="flex-item span-item view-only">to</span>
                        <span class="span-item view-only uppercased">{saturdayVal.close}</span>
                    </template>
    </div>
</div>
<div class="day-wrap slds-grid slds-wrap slds-gutter">
    <div class="slds slds-size_1-of-3">Sunday</div>
    <div class="slds-col slds-size_1-of-1 slds-small-size_1-of-1 slds-medium-size_12-of-12 slds-large-size_6-of-12 inline-flex-wrap">
        <template if:true={sundayClosed}>
                        <span class="flex-item span-item view-only">Close</span>
                    </template>
        <template if:false={sundayClosed}>
                        <span class="span-item view-only uppercased">{sundayVal.open}</span>
                        <span class="flex-item span-item view-only">to</span>
                        <span class="span-item view-only uppercased">{sundayVal.close}</span>
                    </template>
    </div>
</div>
</template>
</div>
</template>
User-added imageIf I were to put a value on Monday like the picture above I want the field beside it to be required if I were to push the proceed button which was not included in the screenshot. The same goes for the other days. The solution should go both ways if I were to put the value on the next dropbox the other field should be required as well. How do I do this?

Need Help. Thanks in advance

In a Digital Experience site: Administration > Login & Registration > Password Pages > Reset Password.

I'm able to choose between "Default Page" and "Visualforce Page".
Rather than building a brand new Visualforce page from scratch

The URL path is /_ui/system/security/ChangePassword.

This is a screenshot of the default page.
User-added image

The timestamp is wrong even though all Default Time Zone is set to (GMT+11:00) Australian Eastern Daylight Time (Australia/Sydney) but it always stamps the wrong time. It would've been correct if it was pm. What do I do to change this is there any workaround? 

the time I tested it is around 1:48 pm.
 
Thanks in advance.

Here's my code:
 
public class AS_UnlockProgramEngagement {
    @InvocableMethod (label = 'Unlock Program Engagement Record'
                      description = 'Unlock Program Engagement Object'
                      category = 'Program Engagement')
    public static void unlockProgramEngagementRecord (){
        List<pmdm__ProgramEngagement__c> brokerageList = [SELECT Id FROM pmdm__ProgramEngagement__c LIMIT 10]; // Get records to unlock
        List<pmdm__ProgramEngagement__c> lockList = new List <pmdm__ProgramEngagement__c>(); // Check locked records
        for(pmdm__ProgramEngagement__c b: brokerageList){
            if(Approval.isLocked(b.id)){
                lockList.add(b);
            }
        }
        if(!lockList.isEmpty()){ // Unlocks Record
            List<Approval.UnlockResult> unlockResultList = Approval.unlock(lockList, false);
            for(Approval.UnlockResult unlockResult : unlockResultList){
                if(unlockResult.isSuccess()){ // Get processed Id of the record
                    system.debug('Successfuly unlocked Brokerage Request' + unlockResult.getId());
                }
                else
                { 
                    for(Database.Error err : unlockResult.getErrors()){ // Get all errors
                        System.debug('The following error has occured.');
                        System.debug(err.getStatusCode() +' : ' + err.getMessage());
                        System.debug('Brokerage Request field that affected this error: ' +err.getFields());
                        // System.debug('Total Quotes Unlocked in the Execution : ' + unlockResultList.size());
                    }         
                }
            }
        }
    }
}


Thanks.
 

Here's my code

public class AS_UnlockApproval {

    @InvocableMethod (label = 'Unlock Record Brokerage Request' description = 'Unlock Brokerage Request Object' category = 'Brokerage Request')
    public static List<Response> Unlock(List<Request> requests) {
        List<Response> responseWrapper= new List<Response>();
        
        for (Request i:  requests) { 
            String recordId = i.recordId;
            
            Approval.UnlockResult unlockResult = Approval.unlock(recordId);

            Response response = new Response();
            
            response.isSuccess = unlockResult.isSuccess();
            response.errors = packErrorString(unlockResult);

            responseWrapper.add(response);
            
        }
        return responseWrapper;
    
    }

    public static String packErrorString(Approval.UnlockResult unlockResult) {
        String errorString = '';
        for(Database.Error err : unlockResult.getErrors()) {
            errorString = errorString + (' The following error has occurred.');                   
            errorString = errorString + (' ' + err.getStatusCode() + ': ' + err.getMessage());
        }
        return errorString;

    }


    public class InvocableErrorException extends Exception{}

    public class Request {

      @InvocableVariable
      public String recordId;
      
    }
    
    public class Response {
     
       @invocableVariable
        public Boolean isSuccess; 
        
        @invocableVariable
        public String errors;
    }
    public class InvocableActionException extends Exception {}
}

I already enabled the process automation on record locking and unlocking.

User-added image
Am I missing something?

I just need to unlock the approval process automatedly since it's not editable. Need Help. Thanks.

Here's my code
global class AS_UpdateContactFromStagingObject implements Database.Batchable<sObject> {

    global Database.QueryLocator start(Database.BatchableContext BC){

        String query = 'SELECT AS_Contact_Id__c, AS_Pronouns__c, AS_Aboriginal_or_Torres_Strait_Islander__c, AS_Date_of_Birth__c, AS_CALD__c, AS_Vaccination_status__c, AS_Require_an_interpreter__c, AS_TIS_Interpreter_Language_Required__c, AS_Safe_to_use_this_phone_number__c, AS_Is_it_safe_to_use_this_email_address__c, AS_Can_a_voicemail_be_left__c, AS_Street__c, AS_City__c, AS_State_Province__c, AS_Zip_Postal_Code__c, AS_Country__c, AS_Why_is_this_their_current_location__c, AS_Agency_Referral__c, AS_Contact_Updated__c FROM Contact_Staging__c WHERE AS_Agency_Referral__c = True AND AS_Contact_Updated__c = False AND AS_Contact_Id__c != null';
        return Database.getQueryLocator(query);

    }
    global void execute(Database.BatchableContext BC, List<Contact_Staging__c> batch) {

        System.debug('batch=='+batch);
        
        
        List<Id> conList = new List<Id>();
        
        for(Contact_Staging__c a : batch){
            conList.add(a.AS_Contact_Id__c);
        }
        
        Map<Id, Contact> mapcontact = new Map<Id, Contact>();
        List<Contact> contacList = new List<Contact>();
        
        for( Contact mapcon: [SELECT Id,caseman__Pronouns__c,AS_Aboriginal_or_Torres_Strait_Islander__c,Birthdate,AS_CALD__c,AS_Vaccination_status__c,
                              AS_TIS_Interpreter_Language_Required__c,AS_Safe_to_use_this_phone_number__c,AS_Is_it_safe_to_use_this_email_address__c,
                              AS_Can_a_voicemail_be_left__c,MailingStreet,MailingCity,MailingState,MailingPostalCode,MailingCountry,AS_Why_is_this_their_current_location__c
                              FROM Contact WHERE Id IN :conList]){
                                  System.debug('mapcon==' + mapcon);
                                  mapcontact.put(mapcon.Id, mapcon);
                              }
		System.debug('mapcontact==' + mapcontact);
        
        for(Contact_Staging__c constage : batch){
            Contact conTemp = mapcontact.get(constage.AS_Contact_Id__c);
            
            if(constage.AS_Pronouns__c != null){
                conTemp.caseman__Pronouns__c = constage.AS_Pronouns__c;
            }
            if(constage.AS_Aboriginal_or_Torres_Strait_Islander__c != null){
                conTemp.AS_Aboriginal_or_Torres_Strait_Islander__c = constage.AS_Aboriginal_or_Torres_Strait_Islander__c;
            }
            if(constage.AS_Date_of_Birth__c != null){
                conTemp.Birthdate = constage.AS_Date_of_Birth__c;
            }
            if(constage.AS_CALD__c != null){
                conTemp.AS_CALD__c = constage.AS_CALD__c;
            }
            if(constage.AS_Vaccination_status__c != null){
                conTemp.AS_Vaccination_status__c = constage.AS_Vaccination_status__c;
            }
            if(constage.AS_TIS_Interpreter_Language_Required__c != null){
                conTemp.AS_TIS_Interpreter_Language_Required__c = constage.AS_TIS_Interpreter_Language_Required__c;
            }
            if(constage.AS_Safe_to_use_this_phone_number__c != null){
                conTemp.AS_Safe_to_use_this_phone_number__c = constage.AS_Safe_to_use_this_phone_number__c;
            }
            if(constage.AS_Is_it_safe_to_use_this_email_address__c != null){
                conTemp.AS_Is_it_safe_to_use_this_email_address__c = constage.AS_Is_it_safe_to_use_this_email_address__c;
            }
            if(constage.AS_Can_a_voicemail_be_left__c != null){
                conTemp.AS_Can_a_voicemail_be_left__c = constage.AS_Can_a_voicemail_be_left__c;
            }
            if(constage.AS_Street__c != null){
                conTemp.MailingStreet = constage.AS_Street__c;
            }
            if(constage.AS_City__c != null){
                conTemp.MailingCity = constage.AS_City__c;
            }
            if(constage.AS_State_Province__c != null){
                conTemp.MailingState = constage.AS_State_Province__c;
            }
            if(constage.AS_Zip_Postal_Code__c != null){
                conTemp.MailingPostalCode = constage.AS_Zip_Postal_Code__c;
            }
            if(constage.AS_Country__c != null){
                conTemp.MailingCountry = constage.AS_Country__c;
            }
            if(constage.AS_Why_is_this_their_current_location__c != null){
                conTemp.AS_Why_is_this_their_current_location__c = constage.AS_Why_is_this_their_current_location__c;
            }
            contacList.add(conTemp);
        }
        
        update contacList;
    }

    global void finish(Database.BatchableContext BC){

    }
}

Thanks.

Fields on contact staging:

Contact_Id__c,
Aboriginal_or_Torres_Strait_Islander__c, (checkbox)
Date_of_Birth__c, (date)
Vaccination_status__c, (picklist)
Agency_Referral__c (checkbox)
Contact_Updated__c  (checkbox)

 

the logic I am referring to is this i don't know if it makes sense.
 

Contact Staging List batch > List Contact Ids

Map<Id, Contact> idConMap = new Map <Id, Contact>
List contact toBeUpdated;

for ( Contact con : [Select Id, fields here FROM Contact WHERE Id in :listContIds] ) {
    idConMap.put( con.Id, con );
}

for ( Contact Staging a : batch ) {
    Contact mapCont = idConMap.get(a.ContactId__c);

    if ( a.field != null ) {
        mapCont.field = a.field;
    }

    toBeUpdated.add( mapCont );
}

update toBeUpdated;
I want to get all the records where Agency Referral is True
And Contact Updated = False. Need Help Thanks

I have a field in contact staging object which are 

  • AS_Date_of_Birth__c (Date)
  • AS_Vaccination_status__c (Picklist)

when the record on contact staging is created I want the fields on contact staging to update the same fields located in contact object.

 

Can anyone help me? Thanks.

How do I map Contact Id to contact staging object contact Id field?

Need help creating a scheduled batch class here is my code.

APEX CLASS:

global class AS_UpdateContactFromStagingObject implements Database.Batchable<sObject> {

    global Database.QueryLocator start(Database.BatchableContext BC){

        String query = 'SELECT AS_Contact_Id__c, AS_Date_of_Birth__c, AS_Vaccination_status__c , AS_Safe_to_use_this_phone_number__c, AS_State_Province__c FROM Contact_Staging__c WHERE AS_Agency_Referral__c = True AND AS_Contact_Updated__c = False';
        return Database.getQueryLocator(query);

    }
    global void execute(Database.BatchableContext BC, List<Contact_Staging__c> batch) {
        System.debug('batch=='+batch);

        List<Contact_Staging__c> conList = new List<Contact_Staging__c>();
        for(Contact_Staging__c a : batch){
            a.AS_Contact_Updated__c = true;
            conList.add(a);
        }


        update conList;

    }
    global void finish(Database.BatchableContext BC){

    }

}

Scheduler:
global class AS_UpdateContactFromStagingSchedulable implements Schedulable {
    public static String sched = '0 00 00 * * ?'; 

    global static String scheduleBatch() {

        AS_UpdateContactFromStagingSchedulable SC = new AS_UpdateContactFromStagingSchedulable(); 

        return System.schedule('Update Contact Records', sched, SC);

    }

    global void execute(SchedulableContext sc) {

        AS_UpdateContactFromStagingObject batch = new AS_UpdateContactFromStagingObject();
        Database.executeBatch(batch, 50);
 

    }

}

so the logic is when you create a new contact stage the contact Id must be an existing Id on contact. the update happens when the contact staging record is created and the batch is running.
 
if the fields on contact staging are not equal to null it updates and if the fields are null nothing will happen. does that make sense? Need Help. Thanks