• Apoorva Sharma
  • NEWBIE
  • 55 Points
  • Member since 2014

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 7
    Questions
  • 4
    Replies
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
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??
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.
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.
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
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
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??
 
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.
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??
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.
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