• Shreyanka
  • NEWBIE
  • 10 Points
  • Member since 2021

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 20
    Questions
  • 9
    Replies
Hi Everyone,

I want to retrieve fields, page layouts, flows, workflow rules, sharing rules, permission sets, visualforce pages, apex classes, roles, email-to-case, communities, record types, approval process, process builders with respect to 2 specific profiles.

Please help me to achieve above requirement using VS-Code.

Can anyone give package.xml file and steps to retrieve it.


Thanks in advance!
Hi Everyone,

How to find all existing Apex class, Triggers, Visualforce pages & Visualforce components version below 21.0.

And how to upgrade all of them to current Api version.

Please help me to achieve this.

Thanks in advance!
Hi Everyone,

I have a requirement like have to auto-populate account's billing address to contact's mailing address when account is updated only if checkbox field is selected on contact.
Also, the same way have to auto-populate contact's mailing address to account's billing address.

please help me to achieve the above requirement.

Thanks in advance!!
Hi Everyone,
I am getting "CSRF with VF Call" checkmarx error from below code. So i have added get method to apex class as shown below. But I am not getting how to call get method in test class.

Please help me to include get method in test class.

Thanks in advance!
 
Apex class:


public class xyz {

        public abc objabc{get;set;}
        public Boolean sendEmail {get; set;}
        public Task objtask{get;set;}
        public boolean isChecked{get;set;}
    public xyz() {
        
        
        String objabcId = ApexPages.currentPage().getParameters().get('id');
                
            objabc = new abc();
        
             if(objabcId !=null && objabcId !=''){
                 
                 objabc = [Select id,OwnerId,name from abc 
                            where id=:ApexPages.currentPage().getParameters().get('id')];
             }
              
            if(objabc.id!=null){
                sendEmail = true;
                objtask= new task();
                objtask.whatid=objabc.id;
                objtask.RecordTypeId = [select Id,Name from RecordType where name='abcd' and SOBjectType='Task' limit 1].Id;
                objtask.status = 'Completed';
                objtask.type = 'Assigned';
                objtask.OwnerID = UserInfo.getUserId();
                objtask.Subject='Assignment';
            }
    }
	public abc getabc(){
		return objabc;
	}
	
      
        public pagereference save() {
            try {
                if(objtask.subject!=null){
                    insert objtask;
                    update objabc;
                    if(sendEmail){                       
                        Database.DMLOptions dlo = new Database.DMLOptions();
                        dlo.EmailHeader.triggerUserEmail = true;
                        database.update(objabc,dlo);                        
                    }
                }else{
                    Apexpages.addMessage(new Apexpages.message(ApexPages.Severity.Error,'Subject cannot be Null !!!'));
                    return null;
                }
                string abcobjurl = objabc.id;
                abcobjurl = abcobjurl.substring(0,3);
                PageReference orderPage = new PageReference('/' + abcobjurl);
                return orderPage;
            } catch (Exception e) {
                system.debug('---inside Exception---'+e.getMessage());
                system.debug('---inside Exception Line---'+e.getLineNumber());
                Apexpages.addMessage(new Apexpages.message(ApexPages.Severity.Error,e.getMessage()));
                return null;
            }
        }
        
}

Below code is the test class that i have written but not getting how to include get method in it.
"i just tried by calling it as Classname.methodname" getting error.
Test class:

@IsTest
Public class TestShareFilesWithCommunityUsers {
    @IsTest
    Public static void testmethod1(){
        Test.startTest();
        abc oAbc =new abc (Name='Demo');//Fill All Required Fields
        insert oAbc ; 
       ApexPages.currentPage().getParameters().put('id',oAbc .id);
       xyz abc= new xyz();
        abc.save();
        abc.objabc = oAbc;
        abc.sendEmail = true;
        Test.stopTest();
        
    }
}

 
Hi Everyone,
I am new to Apex, please help me in writing apex class for " auto populating contact mailing address with account Billing address".

Thanks in advance!
Hi everyone,
I am getting error "Method does not exist or incorrect signature: void method3(List<opportunity>) from the type SampleTriggerHandler" on SampleTrigger class.

Please help me to fix this error.

Thanks in advance!
 
Trigger Code:

trigger SampleTrigger on Abc (before insert,before update, after undelete, after insert, after update) {
    
    if( trigger.isInsert && trigger.isBefore) 
    {
		SampleTriggerHandler.method1(trigger.new,Trigger.oldMap);
    }
    if( (trigger.isUpdate && trigger.isBefore) ||  (trigger.isundelete))
    {
        
        SampleTriggerHandler.method1(trigger.new,Trigger.oldMap);
    }
    if(Trigger.isAfter && (Trigger.isInsert || Trigger.isUpdate || Trigger.isUndelete)) 
	{
        SampleTriggerHandler.method2(Trigger.new, Trigger.oldMap);
    }
    
    if(Trigger.isAfter && (Trigger.isInsert || Trigger.isUpdate ))
    {
		SampleTriggerHandler.method3(trigger.new);
    }
    
}
 
TriggerHandler Code:


public class SampleTriggerHandler {

public static void method1
{
//code block
}

public static void method2
{
//code block
}

    
public static void method3 (List<opportunity> opp)
{
set<id> oppid = new set<id>();

List<opportunity> oppList = [select id, opp_name, from Opportunity where id=:oppid];

List<opportunity> updateList = new List<opportunity>();

Map<Id, opportunity> oppMap= new Map<id,opportunity>();

for(opportunity opp1: oppList) {

}
}
}

 
Hi Everyone,
Please help me in writing test class for below code

Thanks in advance!
Apex Code example:

public class Example{
public class myMethod{

//code block

}

public Example getAbc{
return abc;
}

 public pagereference save() {

//code block

}
}
Hi Everyone,
I am getting "CSRF with VF call"  checkmarx errorfrom the below code.

Please help me to fix this error.

Thanks in advance!
 
1) Apex code:

public class xyz {

        public abc objabc{get;set;}
        public Boolean sendEmail {get; set;}
        public Task objtask{get;set;}
        public boolean isChecked{get;set;}
    public xyz() {
        
        
        String objabcId = ApexPages.currentPage().getParameters().get('id');
                
            objabc = new abc();
        
             if(objabcId !=null && objabcId !=''){
                 
                 objabc = [Select id,OwnerId,name from abc 
                            where id=:ApexPages.currentPage().getParameters().get('id')];
             }
              
            if(objabc.id!=null){
                sendEmail = true;
                objtask= new task();
                objtask.whatid=objabc.id;
                objtask.RecordTypeId = [select Id,Name from RecordType where name='abcd' and SOBjectType='Task' limit 1].Id;
                objtask.status = 'Completed';
                objtask.type = 'Assigned';
                objtask.OwnerID = UserInfo.getUserId();
                objtask.Subject='Assignment';
            }
    }
      
        public pagereference save() {
            try {
                if(objtask.subject!=null){
                    insert objtask;
                    update objabc;
                    if(sendEmail){                       
                        Database.DMLOptions dlo = new Database.DMLOptions();
                        dlo.EmailHeader.triggerUserEmail = true;
                        database.update(objabc,dlo);                        
                    }
                }else{
                    Apexpages.addMessage(new Apexpages.message(ApexPages.Severity.Error,'Subject cannot be Null !!!'));
                    return null;
                }
                string abcobjurl = objabc.id;
                abcobjurl = abcobjurl.substring(0,3);
                PageReference orderPage = new PageReference('/' + abcobjurl);
                return orderPage;
            } catch (Exception e) {
                system.debug('---inside Exception---'+e.getMessage());
                system.debug('---inside Exception Line---'+e.getLineNumber());
                Apexpages.addMessage(new Apexpages.message(ApexPages.Severity.Error,e.getMessage()));
                return null;
            }
        }
        
}
 
2) VF page code:

<apex:page lightningStylesheets="true" Controller="XYZ" >
    <apex:form >
    <apex:pageblock id="PageBlock-Id" title="Select New Owner">
        <apex:pageBlockSection >
            <apex:outputfield value="{!objabc.Name}"/><br/>
            <apex:inputField value="{!objabc.OwnerId}"/>
                <br/>
            
            <apex:inputcheckbox label="Send Notification Email" value="{!sendEmail}" />
            
        </apex:pageBlockSection> 
        
        <apex:pageBlockSection title="Create Task and Log Hours" >
            <apex:pageMessages id="PageMsgId" /><br/>
            <apex:outputField value="{!objtask.RecordTypeId}"/>
            <apex:outputField value="{!objtask.Status}"/>
            <apex:inputField value="{!objtask.Priority}"/>
            <apex:outputField value="{!objtask.type}" />
            <apex:inputField value="{!objtask.Time_Logged__c}"/>
            <apex:inputField style="width:240px;" value="{!objtask.Description}"/>
        </apex:pageBlockSection> 
        
        <div align="center" draggable="false" >
            <apex:commandButton action="{!save}" value="Save" rerender="PageMsgId"/>
        </div>
    </apex:pageblock> 
    </apex:form> 
</apex:page>

 
Hi Everyone,
I am getting "CSRF with VF call" MethodInvokeExpr checkmarx issue in the line 1 of the below code.

Please help me to resolve this.
Thanks in advance!


<apex:page lightningStylesheets="true" Controller="XYZ" >
    <apex:form >
    <apex:pageblock id="PageBlock-Id" title="Select New Owner">
        <apex:pageBlockSection >
            <apex:outputfield value="{!objabc.Name}"/><br/>
            <apex:inputField value="{!objabc.OwnerId}"/>
                <br/>
            
            <apex:inputcheckbox label="Send Notification Email" value="{!sendEmail}" />
            
        </apex:pageBlockSection> 
        
        <apex:pageBlockSection title="Create Task and Log Hours" >
            <apex:pageMessages id="PageMsgId" /><br/>
            <apex:outputField value="{!objtask.RecordTypeId}"/>
            <apex:outputField value="{!objtask.Status}"/>
            <apex:inputField value="{!objtask.Priority}"/>
            <apex:outputField value="{!objtask.type}" />
            <apex:inputField value="{!objtask.Time_Logged__c}"/>
            <apex:inputField style="width:240px;" value="{!objtask.Description}"/>
        </apex:pageBlockSection> 
        
        <div align="center" draggable="false" >
            <apex:commandButton action="{!save}" value="Save" rerender="PageMsgId"/>
        </div>
    </apex:pageblock> 
    </apex:form> 
</apex:page>
Hi everyone,
Please help me in writting test class for the below apex code:

public class xyz {

        public abc objabc{get;set;}
        public Boolean sendEmail {get; set;}
        public Task objtask{get;set;}
        public boolean isChecked{get;set;}
    public xyz() {
        
        
        String objabcId = ApexPages.currentPage().getParameters().get('id');
                
            objabc = new abc();
        
             if(objabcId !=null && objabcId !=''){
                 
                 objabc = [Select id,OwnerId,name from abc 
                            where id=:ApexPages.currentPage().getParameters().get('id')];
             }
              
            if(objabc.id!=null){
                sendEmail = true;
                objtask= new task();
                objtask.whatid=objabc.id;
                objtask.RecordTypeId = [select Id,Name from RecordType where name='abcd' and SOBjectType='Task' limit 1].Id;
                objtask.status = 'Completed';
                objtask.type = 'Assigned';
                objtask.OwnerID = UserInfo.getUserId();
                objtask.Subject='Assignment';
            }
    }
      
        public pagereference save() {
            try {
                if(objtask.subject!=null){
                    insert objtask;
                    update objabc;
                    if(sendEmail){                       
                        Database.DMLOptions dlo = new Database.DMLOptions();
                        dlo.EmailHeader.triggerUserEmail = true;
                        database.update(objabc,dlo);                        
                    }
                }else{
                    Apexpages.addMessage(new Apexpages.message(ApexPages.Severity.Error,'Subject cannot be Null !!!'));
                    return null;
                }
                string abcobjurl = objabc.id;
                abcobjurl = abcobjurl.substring(0,3);
                PageReference orderPage = new PageReference('/' + abcobjurl);
                return orderPage;
            } catch (Exception e) {
                system.debug('---inside Exception---'+e.getMessage());
                system.debug('---inside Exception Line---'+e.getLineNumber());
                Apexpages.addMessage(new Apexpages.message(ApexPages.Severity.Error,e.getMessage()));
                return null;
            }
        }
        
}


Thanks in advance!
Hi everyone,

I have created Approval process for approving records. Here I also want to give access to assigned approvers to edit the Read-only fields present in the record when it is submitted for approval.

I am trying on this. Please help me to achieve this.

Thanks in advance!
Hi everyone,
I have a requirement like "three read-only fields have to be edited only by assigned approvers when the record is submitted for approval".

Please help me to achieve this.

Thanks in advance!
I have created permission set for users who can create records. Also, created "Custom permission" too. Now I have to write a validation rule by calling custom permission into it to prevent users from creating records. How to write validation rules to achieve this.

Please help me to achieve this.


Thanks in advance!!
Hi everyone,

I want to add a "Description " Long text area field on the "Cases" related list section. But it is not showing on the available list section while adding columns on "Cases" related list.

Please help me to achieve this.

Thanks in advance!

​​​
I want to delete a profile but before that, I want to make the document of the references (i.e. apex classes, workflows, process builders, etc) of that specific profile.

please help me to retrieve the above details using VsCode.


Thanks in advance!

 
I have created one rich-text image component for one of the lightning record home pages and I have moved the same record page via Changesets to another Sandbox Org.

But that rich-text image component is not visible in the Sandbox org.

Can anyone help me to figure out what is the issue here?

Thanks in advance!

Can we delete data for a particular field in the record? If yes please share the solution with me.


Thanks in advance!
I tried deleting the files directly from the file content details page, using data loader, and also using apex code. But it's throwing me the error: "This document is awaiting archival. Cannot be deleted at this time. Please try again later"

There is a package installed called Actiance vantage connector on the ContentVersion Object. And it's description is to archive the Salesforce chatter and files. So that package might be restricting us from the delete process of files.

If Anyone has the solution to override the functionality of the Actiance vantage connector package and delete the files. Please share it.


Thanks in advance!
I tried to delete files directly from the content details page, I'm getting an error: "This document is awaiting archival. Cannot delete the file at this time. Please try again later".

Anyone, please share the apex code that deletes content files from salesforce.

Thanks in advance.
When I click delete on a file details page, it's giving me a popup message "This document is awaiting archival and cannot be deleted at this time. please try again later".
why am I getting this message?
And also what is the process to delete files?
Hi Everyone,

How to find all existing Apex class, Triggers, Visualforce pages & Visualforce components version below 21.0.

And how to upgrade all of them to current Api version.

Please help me to achieve this.

Thanks in advance!
Hi Everyone,
I am getting "CSRF with VF Call" checkmarx error from below code. So i have added get method to apex class as shown below. But I am not getting how to call get method in test class.

Please help me to include get method in test class.

Thanks in advance!
 
Apex class:


public class xyz {

        public abc objabc{get;set;}
        public Boolean sendEmail {get; set;}
        public Task objtask{get;set;}
        public boolean isChecked{get;set;}
    public xyz() {
        
        
        String objabcId = ApexPages.currentPage().getParameters().get('id');
                
            objabc = new abc();
        
             if(objabcId !=null && objabcId !=''){
                 
                 objabc = [Select id,OwnerId,name from abc 
                            where id=:ApexPages.currentPage().getParameters().get('id')];
             }
              
            if(objabc.id!=null){
                sendEmail = true;
                objtask= new task();
                objtask.whatid=objabc.id;
                objtask.RecordTypeId = [select Id,Name from RecordType where name='abcd' and SOBjectType='Task' limit 1].Id;
                objtask.status = 'Completed';
                objtask.type = 'Assigned';
                objtask.OwnerID = UserInfo.getUserId();
                objtask.Subject='Assignment';
            }
    }
	public abc getabc(){
		return objabc;
	}
	
      
        public pagereference save() {
            try {
                if(objtask.subject!=null){
                    insert objtask;
                    update objabc;
                    if(sendEmail){                       
                        Database.DMLOptions dlo = new Database.DMLOptions();
                        dlo.EmailHeader.triggerUserEmail = true;
                        database.update(objabc,dlo);                        
                    }
                }else{
                    Apexpages.addMessage(new Apexpages.message(ApexPages.Severity.Error,'Subject cannot be Null !!!'));
                    return null;
                }
                string abcobjurl = objabc.id;
                abcobjurl = abcobjurl.substring(0,3);
                PageReference orderPage = new PageReference('/' + abcobjurl);
                return orderPage;
            } catch (Exception e) {
                system.debug('---inside Exception---'+e.getMessage());
                system.debug('---inside Exception Line---'+e.getLineNumber());
                Apexpages.addMessage(new Apexpages.message(ApexPages.Severity.Error,e.getMessage()));
                return null;
            }
        }
        
}

Below code is the test class that i have written but not getting how to include get method in it.
"i just tried by calling it as Classname.methodname" getting error.
Test class:

@IsTest
Public class TestShareFilesWithCommunityUsers {
    @IsTest
    Public static void testmethod1(){
        Test.startTest();
        abc oAbc =new abc (Name='Demo');//Fill All Required Fields
        insert oAbc ; 
       ApexPages.currentPage().getParameters().put('id',oAbc .id);
       xyz abc= new xyz();
        abc.save();
        abc.objabc = oAbc;
        abc.sendEmail = true;
        Test.stopTest();
        
    }
}

 
Hi Everyone,
I am new to Apex, please help me in writing apex class for " auto populating contact mailing address with account Billing address".

Thanks in advance!
Hi Everyone,
I am getting "CSRF with VF call"  checkmarx errorfrom the below code.

Please help me to fix this error.

Thanks in advance!
 
1) Apex code:

public class xyz {

        public abc objabc{get;set;}
        public Boolean sendEmail {get; set;}
        public Task objtask{get;set;}
        public boolean isChecked{get;set;}
    public xyz() {
        
        
        String objabcId = ApexPages.currentPage().getParameters().get('id');
                
            objabc = new abc();
        
             if(objabcId !=null && objabcId !=''){
                 
                 objabc = [Select id,OwnerId,name from abc 
                            where id=:ApexPages.currentPage().getParameters().get('id')];
             }
              
            if(objabc.id!=null){
                sendEmail = true;
                objtask= new task();
                objtask.whatid=objabc.id;
                objtask.RecordTypeId = [select Id,Name from RecordType where name='abcd' and SOBjectType='Task' limit 1].Id;
                objtask.status = 'Completed';
                objtask.type = 'Assigned';
                objtask.OwnerID = UserInfo.getUserId();
                objtask.Subject='Assignment';
            }
    }
      
        public pagereference save() {
            try {
                if(objtask.subject!=null){
                    insert objtask;
                    update objabc;
                    if(sendEmail){                       
                        Database.DMLOptions dlo = new Database.DMLOptions();
                        dlo.EmailHeader.triggerUserEmail = true;
                        database.update(objabc,dlo);                        
                    }
                }else{
                    Apexpages.addMessage(new Apexpages.message(ApexPages.Severity.Error,'Subject cannot be Null !!!'));
                    return null;
                }
                string abcobjurl = objabc.id;
                abcobjurl = abcobjurl.substring(0,3);
                PageReference orderPage = new PageReference('/' + abcobjurl);
                return orderPage;
            } catch (Exception e) {
                system.debug('---inside Exception---'+e.getMessage());
                system.debug('---inside Exception Line---'+e.getLineNumber());
                Apexpages.addMessage(new Apexpages.message(ApexPages.Severity.Error,e.getMessage()));
                return null;
            }
        }
        
}
 
2) VF page code:

<apex:page lightningStylesheets="true" Controller="XYZ" >
    <apex:form >
    <apex:pageblock id="PageBlock-Id" title="Select New Owner">
        <apex:pageBlockSection >
            <apex:outputfield value="{!objabc.Name}"/><br/>
            <apex:inputField value="{!objabc.OwnerId}"/>
                <br/>
            
            <apex:inputcheckbox label="Send Notification Email" value="{!sendEmail}" />
            
        </apex:pageBlockSection> 
        
        <apex:pageBlockSection title="Create Task and Log Hours" >
            <apex:pageMessages id="PageMsgId" /><br/>
            <apex:outputField value="{!objtask.RecordTypeId}"/>
            <apex:outputField value="{!objtask.Status}"/>
            <apex:inputField value="{!objtask.Priority}"/>
            <apex:outputField value="{!objtask.type}" />
            <apex:inputField value="{!objtask.Time_Logged__c}"/>
            <apex:inputField style="width:240px;" value="{!objtask.Description}"/>
        </apex:pageBlockSection> 
        
        <div align="center" draggable="false" >
            <apex:commandButton action="{!save}" value="Save" rerender="PageMsgId"/>
        </div>
    </apex:pageblock> 
    </apex:form> 
</apex:page>

 
Hi everyone,
Please help me in writting test class for the below apex code:

public class xyz {

        public abc objabc{get;set;}
        public Boolean sendEmail {get; set;}
        public Task objtask{get;set;}
        public boolean isChecked{get;set;}
    public xyz() {
        
        
        String objabcId = ApexPages.currentPage().getParameters().get('id');
                
            objabc = new abc();
        
             if(objabcId !=null && objabcId !=''){
                 
                 objabc = [Select id,OwnerId,name from abc 
                            where id=:ApexPages.currentPage().getParameters().get('id')];
             }
              
            if(objabc.id!=null){
                sendEmail = true;
                objtask= new task();
                objtask.whatid=objabc.id;
                objtask.RecordTypeId = [select Id,Name from RecordType where name='abcd' and SOBjectType='Task' limit 1].Id;
                objtask.status = 'Completed';
                objtask.type = 'Assigned';
                objtask.OwnerID = UserInfo.getUserId();
                objtask.Subject='Assignment';
            }
    }
      
        public pagereference save() {
            try {
                if(objtask.subject!=null){
                    insert objtask;
                    update objabc;
                    if(sendEmail){                       
                        Database.DMLOptions dlo = new Database.DMLOptions();
                        dlo.EmailHeader.triggerUserEmail = true;
                        database.update(objabc,dlo);                        
                    }
                }else{
                    Apexpages.addMessage(new Apexpages.message(ApexPages.Severity.Error,'Subject cannot be Null !!!'));
                    return null;
                }
                string abcobjurl = objabc.id;
                abcobjurl = abcobjurl.substring(0,3);
                PageReference orderPage = new PageReference('/' + abcobjurl);
                return orderPage;
            } catch (Exception e) {
                system.debug('---inside Exception---'+e.getMessage());
                system.debug('---inside Exception Line---'+e.getLineNumber());
                Apexpages.addMessage(new Apexpages.message(ApexPages.Severity.Error,e.getMessage()));
                return null;
            }
        }
        
}


Thanks in advance!
Hi everyone,

I have created Approval process for approving records. Here I also want to give access to assigned approvers to edit the Read-only fields present in the record when it is submitted for approval.

I am trying on this. Please help me to achieve this.

Thanks in advance!
I have created one rich-text image component for one of the lightning record home pages and I have moved the same record page via Changesets to another Sandbox Org.

But that rich-text image component is not visible in the Sandbox org.

Can anyone help me to figure out what is the issue here?

Thanks in advance!
I tried to delete files directly from the content details page, I'm getting an error: "This document is awaiting archival. Cannot delete the file at this time. Please try again later".

Anyone, please share the apex code that deletes content files from salesforce.

Thanks in advance.