• David.HE
  • NEWBIE
  • 0 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 2
    Replies
I have a button for recalling an opportunity for an approval process, but when a user that is not who has submited the opportunity or an administrator recall it, then he gets an error : INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY
That error is fired on just the line what processes the recalling
{
            Approval.ProcessWorkItemRequest pwr = new Approval.ProcessWorkItemRequest();
            pwr.setWorkitemId(w.id);
            pwr.setAction('Removed');
            System.debug('We get an error with this '+ pwr);
            Approval.ProcessResult pr = Approval.process(pwr);
}

What I want to do is to check if the user has edit access over the approval process. But how can I achieve it?

I know how to check if a user has edit access over a record , querying the table UserRecordAccess , but it doesn't work in this case.
I have a custom object and I want to store it with no objects repeated.
I store them in a Set<custom_object_c> , and Custom_object__c is implementing interface comparable and method compareTo .
If I test the method, it works fine.

But if I try to store 2 cloned objects in the Set , it doesn't works and store it.

How can I do for store not repeated objects?

Thanks

Hi to all.

I am copying the behaviour of a button into a new button.

 

I want to invoke an Apex class from a button.

 

This is my code for the class:

 

global class  Observacion {

webservice static  String insertarComentario(String comentario,Id id){
		System.debug('entramos en insertar comentario con los siguientes parámetros');
		System.debug('comentario:'+comentario);
		System.debug('Id:'+id);

		Observaciones__c obs = new Observaciones__c(observacion__c=comentario,comentario__c=id);
		try{
		insert obs;
			}catch(Exception e){
				System.debug('Error insertando observación ' + e.getMessage());
				return 'KO';
			}
	return 'OK';		
 }
}

 

And this is the code inside the button:

sforce.apex.execute("Observacion",
 "insertarComentario",
{comentario:"comentario",
Id:"{!Opportunity.Id}"}
)

 And when I click on the button, I obtain following error :

A problem with the OnClick JavaScript for this button or link was encountered:

{faultcode:'soapenv:Client',faultstring:'No service available for class 'Observacion",}

 

I've been reading in other posts and some peple suggest that it could be a namespace problem, but I don't have any namespaces.

the original code, that it's working fine, is this:

var s = sforce.apex.execute("Escalateaccount","escalate", {varId: leadid });

 

Any tip?

Hi!

I need to invoke a WS when an user update an Account.

 

I had thought in calling the ws inside a trigger, but I'm getting the next exception : 

System.CalloutException: Callout from triggers are currently not supported.

 

Could you give me some tips for solving that inconvenience?

 

 

Thanks in advance

 

I want to add a validation before one user edit an opportunity.

I have created a new custom button and I want to show an alert and after it  open the opportunity in edit mode.

 

I have googled a lot of time and I don't find anything.

 

Any help in how to achive that?

 

 

Thanks,

As you can see in this question, I am new in Test Classes.

 

i have a page wich have 3 opportunity fields,and these fields can be modified.

 

In the test class I need to instanciate the controller and  assign a new value in the opportunity name field.

 

In the controller, I get the opportunity querying to the database using the Id of the Opportunity that I get through Get parameter.

 

Can you help me in achieve it? (I suppose that it should be very easy, but after a long search in internet, I haven't found it)

Hi to all.

I am copying the behaviour of a button into a new button.

 

I want to invoke an Apex class from a button.

 

This is my code for the class:

 

global class  Observacion {

webservice static  String insertarComentario(String comentario,Id id){
		System.debug('entramos en insertar comentario con los siguientes parámetros');
		System.debug('comentario:'+comentario);
		System.debug('Id:'+id);

		Observaciones__c obs = new Observaciones__c(observacion__c=comentario,comentario__c=id);
		try{
		insert obs;
			}catch(Exception e){
				System.debug('Error insertando observación ' + e.getMessage());
				return 'KO';
			}
	return 'OK';		
 }
}

 

And this is the code inside the button:

sforce.apex.execute("Observacion",
 "insertarComentario",
{comentario:"comentario",
Id:"{!Opportunity.Id}"}
)

 And when I click on the button, I obtain following error :

A problem with the OnClick JavaScript for this button or link was encountered:

{faultcode:'soapenv:Client',faultstring:'No service available for class 'Observacion",}

 

I've been reading in other posts and some peple suggest that it could be a namespace problem, but I don't have any namespaces.

the original code, that it's working fine, is this:

var s = sforce.apex.execute("Escalateaccount","escalate", {varId: leadid });

 

Any tip?

As you can see in this question, I am new in Test Classes.

 

i have a page wich have 3 opportunity fields,and these fields can be modified.

 

In the test class I need to instanciate the controller and  assign a new value in the opportunity name field.

 

In the controller, I get the opportunity querying to the database using the Id of the Opportunity that I get through Get parameter.

 

Can you help me in achieve it? (I suppose that it should be very easy, but after a long search in internet, I haven't found it)