-
ChatterFeed
-
1Best Answers
-
0Likes Received
-
0Likes Given
-
7Questions
-
4Replies
opportunities close date as today()?
Hi all,
I am beginer of salesforce.Please any one help me the following code implementation. how to Write Apex class to update all the opportunities close date as today()?
Thanks in advance
I am beginer of salesforce.Please any one help me the following code implementation. how to Write Apex class to update all the opportunities close date as today()?
Thanks in advance
-
- Balasubramani Dhanapal
- January 10, 2015
- Like
- 0
- Continue reading or reply
workaround for javascript in custom home page link
Hi,
i have a requirement where, some statndards components needed to be hidden. With winter 16 release this is not working as expected.
Does anyone have a workaround for this??
i have a requirement where, some statndards components needed to be hidden. With winter 16 release this is not working as expected.
Does anyone have a workaround for this??
-
- Apoorva Sharma
- September 15, 2015
- Like
- 0
- Continue reading or reply
Dml Query in Static Resource
Hi All,
I have a requirement in which i need to query some of the opportunity field in a static resource. Ill be using the static resource as a home page component(custom link).My static file is written in javascript. I tried querying but somehow i am not able to include the following scripts :
{!REQUIRESCRIPT("/soap/ajax/29.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/22.0/apex.js")}
Can some please suggest me a method to procced. Thanks in advance.
I have a requirement in which i need to query some of the opportunity field in a static resource. Ill be using the static resource as a home page component(custom link).My static file is written in javascript. I tried querying but somehow i am not able to include the following scripts :
{!REQUIRESCRIPT("/soap/ajax/29.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/22.0/apex.js")}
Can some please suggest me a method to procced. Thanks in advance.
-
- Apoorva Sharma
- March 26, 2015
- Like
- 0
- Continue reading or reply
Using static javascript in custom links
Hey all
I am using javascript to hide certain things from standard pages and home page. i am able to hide all those things but loosing my global search functinality. When i click on search icon of global search nothing happens.
I am using javascript to hide certain things from standard pages and home page. i am able to hide all those things but loosing my global search functinality. When i click on search icon of global search nothing happens.
-
- Apoorva Sharma
- February 03, 2015
- Like
- 0
- Continue reading or reply
Delete failed. First exception : DELETE_FAILED, cannot delete owner or rule share rows
Hi All,
I am trying to Programmatically delete Sharing Rules with Apex. I am getting the following exception cannot delete owner or rule share rows. Below is my code:
public static void RestrictShare(List<Account> slist){
List<ID> shareIdsToDelete = new List<ID>();
for (Approval_Stage__c stage:slist) {
if (stage.Share__c == false) {
shareIdsToDelete.add(stage.id);
}
}
if (!shareIdsToDelete.isEmpty()){
delete [select id from AccountShare where AccountShare.Id IN :shareIdsToDelete];
}
}
I am calling it in a after update trigger
I am trying to Programmatically delete Sharing Rules with Apex. I am getting the following exception cannot delete owner or rule share rows. Below is my code:
public static void RestrictShare(List<Account> slist){
List<ID> shareIdsToDelete = new List<ID>();
for (Approval_Stage__c stage:slist) {
if (stage.Share__c == false) {
shareIdsToDelete.add(stage.id);
}
}
if (!shareIdsToDelete.isEmpty()){
delete [select id from AccountShare where AccountShare.Id IN :shareIdsToDelete];
}
}
I am calling it in a after update trigger
-
- Apoorva Sharma
- January 15, 2015
- Like
- 0
- Continue reading or reply
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: Account:
Hii all
I am trying to asssign a user dynamically to a permission set but got mixed dml exception. Here is my code:
Public class PermissionSetAccess{
public static void execute(Id id,List<SObject> scope) {
List<PermissionSetAssignment> newPermissionSetAccess = new List<PermissionSetAssignment>(); //list for new permission sets
Set<String> usersWithAccess = new Set<String>(); //set for users Ids with access to the permission set already
Id psaId; //Id of the permission set we want Users to be assigned
//query for the permission set Id
for (PermissionSet ps : [SELECT Id FROM PermissionSet WHERE Name = 'Approver']) {
system.debug('in ps query');
psaId = ps.Id; //assign the premission set Id
for (PermissionSetAssignment psa : [SELECT AssigneeId FROM PermissionSetAssignment WHERE PermissionSetId = :ps.Id]) { //query for the permission set Users that are already assigned
usersWithAccess.add(psa.AssigneeId); //add the Id of each assigned User to our set
system.debug('usersWithAccess.add(psa.AssigneeId)'+usersWithAccess);
}
}
//compare the list of all users to the list of already granted users and make another list of those missing access
//take that list of missing access and grant access
for (SObject s : scope) { //for all objects from our batch
//User u = (User)s; //grab the individual User record
if (!usersWithAccess.contains(id)) { //if the User is not in our 'already has access' set
PermissionSetAssignment newPSA = new PermissionSetAssignment(); //PermissionSetAssignment sobject
newPSA.PermissionSetId = psaId; //set the permission set Id
newPSA.AssigneeId = id; //set the User Id
newPermissionSetAccess.add(newPSA); //add the record to our list
}
}
if (!newPermissionSetAccess.isEmpty()) { //if there are records to insert
insert newPermissionSetAccess; //insert
system.debug('sucess');
}
}
}
i am calling it in a triggerr
I am trying to asssign a user dynamically to a permission set but got mixed dml exception. Here is my code:
Public class PermissionSetAccess{
public static void execute(Id id,List<SObject> scope) {
List<PermissionSetAssignment> newPermissionSetAccess = new List<PermissionSetAssignment>(); //list for new permission sets
Set<String> usersWithAccess = new Set<String>(); //set for users Ids with access to the permission set already
Id psaId; //Id of the permission set we want Users to be assigned
//query for the permission set Id
for (PermissionSet ps : [SELECT Id FROM PermissionSet WHERE Name = 'Approver']) {
system.debug('in ps query');
psaId = ps.Id; //assign the premission set Id
for (PermissionSetAssignment psa : [SELECT AssigneeId FROM PermissionSetAssignment WHERE PermissionSetId = :ps.Id]) { //query for the permission set Users that are already assigned
usersWithAccess.add(psa.AssigneeId); //add the Id of each assigned User to our set
system.debug('usersWithAccess.add(psa.AssigneeId)'+usersWithAccess);
}
}
//compare the list of all users to the list of already granted users and make another list of those missing access
//take that list of missing access and grant access
for (SObject s : scope) { //for all objects from our batch
//User u = (User)s; //grab the individual User record
if (!usersWithAccess.contains(id)) { //if the User is not in our 'already has access' set
PermissionSetAssignment newPSA = new PermissionSetAssignment(); //PermissionSetAssignment sobject
newPSA.PermissionSetId = psaId; //set the permission set Id
newPSA.AssigneeId = id; //set the User Id
newPermissionSetAccess.add(newPSA); //add the record to our list
}
}
if (!newPermissionSetAccess.isEmpty()) { //if there are records to insert
insert newPermissionSetAccess; //insert
system.debug('sucess');
}
}
}
i am calling it in a triggerr
-
- Apoorva Sharma
- January 10, 2015
- Like
- 0
- Continue reading or reply
Passing javascript array to apex class
Hi,
I want to pass javascript array to apex class. my code is:
VF Page:
<apex:page Controller="MyController" id="page" >
<apex:form >
<apex:commandButton value="Save" action="{!say}"/>
<apex:inputHidden id="hiddenParamValueFromJavaScript" value="{!ParamValueFromJavaScript}" />
<apex:dynamicComponent componentValue="{!form}" id="dynamic" />
<script type="text/javascript">
List=[val1,val2,val3];
var ctrl = document.querySelector('[id$="hiddenParamValueFromJavaScript"]');
ctrl.value = List;
</script>
</apex:form>
</apex:page>
Apex Class:
public class MyController
{
public String form { get; set; }
public MyController() {
}
public MyController(ApexPages.StandardController controller)
{
}
public String[] ParamValueFromJavaScript {get;set;}
public void say(){
system.debug(ParamValueFromJavaScript);
}
}
But in debug log i am not able to see the debug statement. I am getting the following error:
Invalid conversion from runtime type String to LIST<String>
Can someone please help me with this??
I want to pass javascript array to apex class. my code is:
VF Page:
<apex:page Controller="MyController" id="page" >
<apex:form >
<apex:commandButton value="Save" action="{!say}"/>
<apex:inputHidden id="hiddenParamValueFromJavaScript" value="{!ParamValueFromJavaScript}" />
<apex:dynamicComponent componentValue="{!form}" id="dynamic" />
<script type="text/javascript">
List=[val1,val2,val3];
var ctrl = document.querySelector('[id$="hiddenParamValueFromJavaScript"]');
ctrl.value = List;
</script>
</apex:form>
</apex:page>
Apex Class:
public class MyController
{
public String form { get; set; }
public MyController() {
}
public MyController(ApexPages.StandardController controller)
{
}
public String[] ParamValueFromJavaScript {get;set;}
public void say(){
system.debug(ParamValueFromJavaScript);
}
}
But in debug log i am not able to see the debug statement. I am getting the following error:
Invalid conversion from runtime type String to LIST<String>
Can someone please help me with this??
-
- Apoorva Sharma
- December 10, 2014
- Like
- 0
- Continue reading or reply
Using values from javascript in apex class
Hi,
i have a requirement in which i need to get javascript variables in apex class.If anyone can help with a code example, I'd appreciate it.
i have a requirement in which i need to get javascript variables in apex class.If anyone can help with a code example, I'd appreciate it.
-
- Apoorva Sharma
- December 09, 2014
- Like
- 0
- Continue reading or reply
workaround for javascript in custom home page link
Hi,
i have a requirement where, some statndards components needed to be hidden. With winter 16 release this is not working as expected.
Does anyone have a workaround for this??
i have a requirement where, some statndards components needed to be hidden. With winter 16 release this is not working as expected.
Does anyone have a workaround for this??
- Apoorva Sharma
- September 15, 2015
- Like
- 0
- Continue reading or reply
Dml Query in Static Resource
Hi All,
I have a requirement in which i need to query some of the opportunity field in a static resource. Ill be using the static resource as a home page component(custom link).My static file is written in javascript. I tried querying but somehow i am not able to include the following scripts :
{!REQUIRESCRIPT("/soap/ajax/29.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/22.0/apex.js")}
Can some please suggest me a method to procced. Thanks in advance.
I have a requirement in which i need to query some of the opportunity field in a static resource. Ill be using the static resource as a home page component(custom link).My static file is written in javascript. I tried querying but somehow i am not able to include the following scripts :
{!REQUIRESCRIPT("/soap/ajax/29.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/22.0/apex.js")}
Can some please suggest me a method to procced. Thanks in advance.
- Apoorva Sharma
- March 26, 2015
- Like
- 0
- Continue reading or reply
opportunities close date as today()?
Hi all,
I am beginer of salesforce.Please any one help me the following code implementation. how to Write Apex class to update all the opportunities close date as today()?
Thanks in advance
I am beginer of salesforce.Please any one help me the following code implementation. how to Write Apex class to update all the opportunities close date as today()?
Thanks in advance
- Balasubramani Dhanapal
- January 10, 2015
- Like
- 0
- Continue reading or reply