• sfadm sfdev
  • NEWBIE
  • 40 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 13
    Questions
  • 10
    Replies
Hello,

Please have a look at the attached screenshot file.

Could you please advise how to replace the standard Unlock Recrod button with a custom button after Submit for Approva is pressed?

Thank you



 
I have a custom buttom which invokes my custom method. I need this custom method to save data or information which will be used few days later, for instance after five days. The infromation will be used by another class and method which is invoked by a trigger.

I have tried to implement it the following way but it doesn't work.
In the first class I have created a field wich is initialized in my custom method.
public class UnlockRecordDuringApprovalController {

    private static String userIdToPressUnlock;

    public static String getUserIdToPressUnlock() {
        if(userIdToPressUnlock == null) {
            System.debug('userIdToPressUnlock1 ' + userIdToPressUnlock);
        	return '';
        }
        System.debug('userIdToPressUnlock7 ' + userIdToPressUnlock);
    	return userIdToPressUnlock;
    }
   
    public static PageReference processRecord() {
        ...
        userIdToPressUnlock = UserInfo.getUserId();
    }
}

When the second method is invoked in second class I'm trying to get the value of the variable but when I invoke the getter method from the first class the returned value is NULL.
 
public class OppHandler implements ITrigger {
    @future
    private static void setUnlockOpp() {
        ...
        String userIdToPressUnlock = UnlockRecordDuringApprovalController.getUserIdToPressUnlock();        
         PermissionSetAssignment psa = new PermissionSetAssignment(PermissionSetId = unlockPsId, AssigneeId = userIdToPressUnlock);
         insert psa;
    }
}

Is there a way in Apex how to pass the information or data from the first method from the first class to the method in the second class having in mind the code in the second class will be invoked after five days?

One way that comes to my mind is to store the infomation in a file.

Is that ok and will it work?


 
Hello,

I have created a custom button with associated custom visualforce page.

Everytime the custom button is pressed it opens the custom visualforce page.

What I would like know is how to prevent the custom visualforce to appear every time the custom button is pressed?

Instead I would like to appear the previous standard page and to be able redirect the vf page to the standard one so when the cussom button is pressed NO CUSTOM Visulalforce page TO APPEAR.

Is there a way in Saleseforce to redirect a custom visulalforce page to a standard one?

Thank you
Hello,

I'd like to know and could you please advise how the following functionality can be achieved in Saleforce:
When a Salesforce user opens a task, he/she will have to monitor and observe what happened and when.
What I would like to achieve is to give the user detail information presented the following way:
Task Name

Originator

user 1

date and time

comment 1

user 2

date and time 

comment 2

user 3

date and time

comment 3

Where:
- user is the name of the employee
- when did she/he wrote or left a message
- what was the message in the comment area
Please advise how this can be achieved in Salesforce,

Thank you
 
Hello,

I'm trying to build a star rating functionality which is described in the following site:
http://kgoutam.blogspot.bg/2013/02/show-star-rating-as-salesforce-standard.html

I followed the steps in the site but instead of visualizing stars in the section I created in the Account object I see a drop down list with five numbers.
This is how it looks:
User-added image

I suppose the issue in the two static resource fiels which I uploaded
a-OrgResource
b-jQueryStarRatingPlugIn
because I've tried to upload different files for example .png .jpeg format files which are not .css and .js but there is no change and the five number drop down list still appears.

Could you please advise an appropriate solution to this issue I have.

Thank you
Hello,

I'd like to continue my conversation from my previous discussion with subject "Avoid Error: MIXED_DML_OPERATION".

What I'd like know now is how to set the permission set
PermissionSetAssignment psa = new PermissionSetAssignment(PermissionSetId = '0PS7E000000DBGA', AssigneeId = currentuserId);
when the Approval process is over.

The Approval process is actually over when the stage of the current Opportunity is changed to "Proposal".
Opportunity Stage

In order to find out when the Opportunity stage will be changed from "Discovery" to "Proposal" I was thinking of implementing an event listener which will monitor the Opportinity stage. And when the Opportunity stage is changed to "Proposal" the listener will invoke the DeletePErmissionSetAssignemt() method. I know this can be achieved in Java but in I'm not fully aware how to implement such an event listener in Salesforce. Could you please advise and give an example of how to implement an event listener in Salesforce? If there is no such way can you suggest an appropriate solution to what I'm trying to achive?

Thank you
Hello,

I'm using the following code to unlock the Opportunity record:
public class UnlockRecordDuringApprovalController {
    Opportunity objOpportunity;
    // String objOpp;
    String currentuserId = UserInfo.getUserId();
	
	public UnlockRecordDuringApprovalController(ApexPages.StandardController controller) {
    	objOpportunity = (Opportunity)controller.getRecord();
	}
	
    public void processRecord() {
        Approval.UnlockResult unlockedRersult = Approval.unlock(objOpportunity);
        // Iterate through each returned result
        if (unlockedRersult.isSuccess()) {
            // Operation was successful, so get the ID of the record that was processed
            System.debug('Successfully unlocked opportunity with ID: ' + unlockedRersult.getId());
        }
        else {
            // Operation failed, so get all errors                
            for(Database.Error err : unlockedRersult.getErrors()) {
                System.debug('The following error has occurred.');                    
                System.debug(err.getStatusCode() + ': ' + err.getMessage());
                System.debug('opportunity fields that affected this error: ' + err.getFields());
            }
        }
        System.debug('currentuserId ' + currentuserId);
        List<PermissionSetAssignment> listPermissionSets = [SELECT Id, AssigneeId, PermissionSetId FROM PermissionSetAssignment WHERE AssigneeId = :currentuserId AND PermissionSetId IN (SELECT Id FROM PermissionSet WHERE IsOwnedByProfile = false)];
        delete listPermissionSets;
        PermissionSetAssignment psa = new PermissionSetAssignment(PermissionSetId = '0PS7E000000DBGA', AssigneeId = currentuserId);		
        System.debug('psa ' + psa);
        insert psa;
		System.debug('psa7 ' + psa);
    }   
}
After the Opportunity record is unlocked I want to:
1. store all permission sets assigned to the current user
2. remove all permission sets associated to the currently logged user
3. give to the user specific and custom permission set.
My custom permission set is restricting the current user to edit certain fields in the Opportunity object.
When the approval process finish I need to retrieve the removed permission sets and remove my custom permission set.
I have created my own custom button and when the button is pressed the above code is executed but I receive the following error message:
Delete failed. First exception on row 0 with id 0Pa7E000001PBlTSAW; first error: MIXED_DML_OPERATION, DML operation on setup object is not permitted after you have updated a non-setup object (or vice versa): PermissionSetAssignment, original object: EntityLock: [] Error is in expression '{!processRecord}' in component in page unlockopportunityrecord: Class.UnlockRecordDuringApprovalController.processRecord: line 27, column 1
Could you please advise what is the cause of such error message and how it can be avoided?

Thank you

 
Hello,

Could you please help me understand why I receive the following error:
Delete failed. First exception on row 0 with id 04Z7E000000596S; first error: INSUFFICIENT_ACCESS_OR_READONLY, insufficient access rights on object id: []
Error is in expression '{!processRecord}' in component <apex:page> in page unlockopportunityrecord: External entry point
every time I try to unlock an Opportunity record.
The code in the apex class that I'm using is:
public with sharing class UnlockRecordDuringApprovalController {
        Opportunity objOpportunity;
        String objOpp;
	
        public UnlockRecordDuringApprovalController(ApexPages.StandardController controller) {
    	objOpportunity = (Opportunity)controller.getRecord();
	}
	
       public void processRecord() {
        Approval.UnlockResult unlockedRersult = Approval.unlock(objOpportunity);
        // Iterate through each returned result
        if (unlockedRersult.isSuccess()) {
            // Operation was successful, so get the ID of the record that was processed
            System.debug('Successfully unlocked opportunity with ID: ' + unlockedRersult.getId());
        }
        else {
            // Operation failed, so get all errors                
            for(Database.Error err : unlockedRersult.getErrors()) {
                System.debug('The following error has occurred.');                    
                System.debug(err.getStatusCode() + ': ' + err.getMessage());
                System.debug('opportunity fields that affected this error: ' + err.getFields());
            }
        }
    }    
}
and the Visual Force page code is:
<apex:page standardController="opportunity" extensions="UnlockRecordDuringApprovalController"  action="{!processRecord}" >
</apex:page>
Could you please explain what is causing this error to appear and prevent the unlock of the Opportunity record?

It is quite urgent to find a solution.

Thank you


 
Hello,

I need to take programmatically the currently logged user via apex source code to change the permissions of that user.
Here is my code:
public with sharing class UnlockRecordDuringApprovalController {
 
Opportunity objOpportunity;
 
public UnlockRecordDuringApprovalController(ApexPages.StandardController controller) { 
objOpportunity = (Opportunity)controller.getRecord(); 
}
 
public void processRecord() {
 
}
 
}


Please advise or give example(s) how this can be achieved in Salesforce?
Thank you
Hello,

I have created a custom javascript button and I've implemented my own javascript code to unlock the Opportunity record when the record is submitted for approval.
When I remove the "Modify All" permissions from the Opportunity Permission Set for particular user and the custom unlock button is clicked, an error message appears that the currently logged user does not have permissions to unlock the Opportunity object.
Insufficient Privileges You do not have the level of access necessary to perform the operation you requested. Please contact the owner of the record or your administrator if access is necessary. For more information, see Insufficient Privileges Errors.
What I need to know is:
1. How to get the ID of the currently logged user via javascript?
2. How to modify and alter the permission set of the currently logged user via javascript?
- in the currently logged user I must set "Modify All" permissions via javascript when the current user does not have such permissions?

Thank you
I experience the following exception:
Stale Session Exception The page you submitted was invalid for your session. Please try your action again.
every time I execute the following javascript code:
 
// Get the URL String.
var recordURL = document.URL;
var URLlength = recordURL.length;

// Get the record ID from the URL.
// Id length of Opportunity object is 15
var opportunityId = recordURL.substring((URLlength - 15), URLlength);
alert("opportunityId " + opportunityId);
var confirmationToken = chatter.getToolbox().token();
alert("confirmationToken " + confirmationToken);

// Unlock the opportunity record
if ((Modal.confirm && Modal.confirm('Are you sure?')) || (!Modal.confirm &&
window.confirm('Are you sure?'))) navigateToUrl('/_ui/core/entitylock
/LockHandler?id=' + opportunityId + '&un=1&_CONFIRMATIONTOKEN=' +
confirmationToken + '\',\'DETAIL\',\'unlock\'');
The value from confirmationToken alert is different from the value in the HTML page source.
Could you please explain why the chatter.getToolbox().token(); returns different results/values.
Could you please advise an appropriate solution to the Stale Session Exception I get?
 
I came across to the followin error:

Error:
This grid is not Active. Please contact your administrator.

Please advise how to be able to resolve such error.

Here is the code of the vf page:
<apex:page StandardController="Opportunity" showHeader="false" sidebar="false">
<apex:form >
<GridWiz_Unlimit:GridWizardComponent ObjectName="Opportunity" Objunique="{!Opportunity.Id}" grid="a0hD000000ENwKBIA1"/>
</apex:form>
</apex:page>

 
Is there a possibility in Salesforce to configure all external emails from clients go as well as to be integrated automatically in Saleforce. The idea is that if an email is received from a client such email to be integrated automatically in the system without having to use a mail client application such as Outlook etc. Is that feasible in Salesforce and how it can be achieved?
Hello,

Please have a look at the attached screenshot file.

Could you please advise how to replace the standard Unlock Recrod button with a custom button after Submit for Approva is pressed?

Thank you



 
Hello,

I'm trying to build a star rating functionality which is described in the following site:
http://kgoutam.blogspot.bg/2013/02/show-star-rating-as-salesforce-standard.html

I followed the steps in the site but instead of visualizing stars in the section I created in the Account object I see a drop down list with five numbers.
This is how it looks:
User-added image

I suppose the issue in the two static resource fiels which I uploaded
a-OrgResource
b-jQueryStarRatingPlugIn
because I've tried to upload different files for example .png .jpeg format files which are not .css and .js but there is no change and the five number drop down list still appears.

Could you please advise an appropriate solution to this issue I have.

Thank you
Hello,

I'd like to continue my conversation from my previous discussion with subject "Avoid Error: MIXED_DML_OPERATION".

What I'd like know now is how to set the permission set
PermissionSetAssignment psa = new PermissionSetAssignment(PermissionSetId = '0PS7E000000DBGA', AssigneeId = currentuserId);
when the Approval process is over.

The Approval process is actually over when the stage of the current Opportunity is changed to "Proposal".
Opportunity Stage

In order to find out when the Opportunity stage will be changed from "Discovery" to "Proposal" I was thinking of implementing an event listener which will monitor the Opportinity stage. And when the Opportunity stage is changed to "Proposal" the listener will invoke the DeletePErmissionSetAssignemt() method. I know this can be achieved in Java but in I'm not fully aware how to implement such an event listener in Salesforce. Could you please advise and give an example of how to implement an event listener in Salesforce? If there is no such way can you suggest an appropriate solution to what I'm trying to achive?

Thank you
Hello,

I'm using the following code to unlock the Opportunity record:
public class UnlockRecordDuringApprovalController {
    Opportunity objOpportunity;
    // String objOpp;
    String currentuserId = UserInfo.getUserId();
	
	public UnlockRecordDuringApprovalController(ApexPages.StandardController controller) {
    	objOpportunity = (Opportunity)controller.getRecord();
	}
	
    public void processRecord() {
        Approval.UnlockResult unlockedRersult = Approval.unlock(objOpportunity);
        // Iterate through each returned result
        if (unlockedRersult.isSuccess()) {
            // Operation was successful, so get the ID of the record that was processed
            System.debug('Successfully unlocked opportunity with ID: ' + unlockedRersult.getId());
        }
        else {
            // Operation failed, so get all errors                
            for(Database.Error err : unlockedRersult.getErrors()) {
                System.debug('The following error has occurred.');                    
                System.debug(err.getStatusCode() + ': ' + err.getMessage());
                System.debug('opportunity fields that affected this error: ' + err.getFields());
            }
        }
        System.debug('currentuserId ' + currentuserId);
        List<PermissionSetAssignment> listPermissionSets = [SELECT Id, AssigneeId, PermissionSetId FROM PermissionSetAssignment WHERE AssigneeId = :currentuserId AND PermissionSetId IN (SELECT Id FROM PermissionSet WHERE IsOwnedByProfile = false)];
        delete listPermissionSets;
        PermissionSetAssignment psa = new PermissionSetAssignment(PermissionSetId = '0PS7E000000DBGA', AssigneeId = currentuserId);		
        System.debug('psa ' + psa);
        insert psa;
		System.debug('psa7 ' + psa);
    }   
}
After the Opportunity record is unlocked I want to:
1. store all permission sets assigned to the current user
2. remove all permission sets associated to the currently logged user
3. give to the user specific and custom permission set.
My custom permission set is restricting the current user to edit certain fields in the Opportunity object.
When the approval process finish I need to retrieve the removed permission sets and remove my custom permission set.
I have created my own custom button and when the button is pressed the above code is executed but I receive the following error message:
Delete failed. First exception on row 0 with id 0Pa7E000001PBlTSAW; first error: MIXED_DML_OPERATION, DML operation on setup object is not permitted after you have updated a non-setup object (or vice versa): PermissionSetAssignment, original object: EntityLock: [] Error is in expression '{!processRecord}' in component in page unlockopportunityrecord: Class.UnlockRecordDuringApprovalController.processRecord: line 27, column 1
Could you please advise what is the cause of such error message and how it can be avoided?

Thank you

 
Hello,

Could you please help me understand why I receive the following error:
Delete failed. First exception on row 0 with id 04Z7E000000596S; first error: INSUFFICIENT_ACCESS_OR_READONLY, insufficient access rights on object id: []
Error is in expression '{!processRecord}' in component <apex:page> in page unlockopportunityrecord: External entry point
every time I try to unlock an Opportunity record.
The code in the apex class that I'm using is:
public with sharing class UnlockRecordDuringApprovalController {
        Opportunity objOpportunity;
        String objOpp;
	
        public UnlockRecordDuringApprovalController(ApexPages.StandardController controller) {
    	objOpportunity = (Opportunity)controller.getRecord();
	}
	
       public void processRecord() {
        Approval.UnlockResult unlockedRersult = Approval.unlock(objOpportunity);
        // Iterate through each returned result
        if (unlockedRersult.isSuccess()) {
            // Operation was successful, so get the ID of the record that was processed
            System.debug('Successfully unlocked opportunity with ID: ' + unlockedRersult.getId());
        }
        else {
            // Operation failed, so get all errors                
            for(Database.Error err : unlockedRersult.getErrors()) {
                System.debug('The following error has occurred.');                    
                System.debug(err.getStatusCode() + ': ' + err.getMessage());
                System.debug('opportunity fields that affected this error: ' + err.getFields());
            }
        }
    }    
}
and the Visual Force page code is:
<apex:page standardController="opportunity" extensions="UnlockRecordDuringApprovalController"  action="{!processRecord}" >
</apex:page>
Could you please explain what is causing this error to appear and prevent the unlock of the Opportunity record?

It is quite urgent to find a solution.

Thank you


 
Hello,

I have created a custom javascript button and I've implemented my own javascript code to unlock the Opportunity record when the record is submitted for approval.
When I remove the "Modify All" permissions from the Opportunity Permission Set for particular user and the custom unlock button is clicked, an error message appears that the currently logged user does not have permissions to unlock the Opportunity object.
Insufficient Privileges You do not have the level of access necessary to perform the operation you requested. Please contact the owner of the record or your administrator if access is necessary. For more information, see Insufficient Privileges Errors.
What I need to know is:
1. How to get the ID of the currently logged user via javascript?
2. How to modify and alter the permission set of the currently logged user via javascript?
- in the currently logged user I must set "Modify All" permissions via javascript when the current user does not have such permissions?

Thank you