• dai developer
  • NEWBIE
  • 20 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 7
    Replies
Hello,

I´ve to make a little funcionality where oAuth is used and after googling it I don´t know if I have an enormous problem or not problem at all.

Every information I find is related to authentication from the salesforce side but what I have to do is authenticate an external callout with an external oAuth endpoint.

It can be resumed this way:

External someone call myHttpPOST apex class method(which NOT includes oAuth flow)

This external wants me to authenticate his request so gives me an oAuth Url which I´ll have to request(POST ay ay), depending of the response, I´ll generate an adecuate response to the original request to my POST apex rest.

Then, I´ll have a POST apex method which receive a request and inside of my method I´ll have to make a POST request to an external URL because cannot have two apex post methods in the same class.

As I said, I´m not sure if I understood a word or I´m finding problems where there are not.

Thanks, regards

 
Hello

I have three scheduled jobs chained, one of them must be scheduled only if it`s the first day of the month.

This way:

Update all the Accounts, ten Accounts at a time managing a custom setting to re-schedule Account update job from the last Id processed, when the last Account is processed, then custom setting is updated to null and begin Update Contacts job...

Update Contact job is identical to Update Account Job, including the same custom setting to divide the execution in ten Contacts execution and then..

I have if (today.day == 1) then schedule a third job which updates Products, when its finished Account update job is scheduled to the next day

else (a different day than 1) I schedule Account update job to the next day and previously, custom setting is updated to null.


Well, there was a mistake in this code (I didnt do it :) ) because in the case its day 1, i dont update to null the custom setting so next day Contact job will begin to process from the last processed day 1, but this is not the problem I want to solve, although I can discard it`s related to my main issue.

Last, but not least, the code executes inside try-catch, sending an email in case of exception.

Well, my problem began at January 1st, from that day to day 15, execution of Contact jobs processed more or less 500 records(over a total of 30000) and then stopped, WITHOUT updating the custom setting causing the next day the first contact processed was the last processed the previous day. Day one were processed the contacts of index 1 to 500, second day 500 to 1000, third day 1000 to 1234, cause there are 1234 contacts at all, where the implementation is supposed to process every Contact every day.

What I really can`t understand and makes me go crazy is that in case of any error, updating custom setting, contact, null lists, whatever, an email is supposed to be sent to me and there was no email sent so there was not error or (crazy) there was an email error each day from January 1st to January 15th

Any ideas would be apreciated, and, yes, next time I`ll look for a better solution than chained jobs.

Regards and happy new year everybody
Hello,

I have to import a file and read it (and validate the data) but cannot.

It has ".dat" extension and can edit it with notepad without a problem but with <inputfile> the body (utf8 encoded)
of the file is an unreadable sequence of chars (bytes?).

If i edit the file.dat with an editor and save it as .csv, my code works perfect(even break lines stay) but, curious enough, if i simply change
the file.dat extension to csv, i obtain the same unreadable string.

The code:

<apex:page controller="c_CargaFicheroPedidoController">
   
     <apex:form >
        <apex:pagemessages /> 
        <apex:pageBlock >
            <apex:pageBlockSection columns="4">
                
                  <apex:inputFile value="{!csvFileBody}"  filename="{!csvAsString}" contentType="text/plain"/>

the controller

string dddfff = EncodingUtil.base64Encode(csvFileBody);

Thanks everybody



Hello,

I build an Url like this:

//s?cancelURL=%2FcaseId&saveURL=%2F_ui%2Fcore%2Femail%2Fauthor%2FEmailAuthor?p3_lkid=caseId&template_id=emailTemplateId&rtype=500&p2_lkid=contactId

Redirect

pagereference ....(urlBuild) ---------------> bum!

somehow between urlBuild and the disaster, two of the parameters travel from saveurl to cancelurl like this

//s?cancelURL=%2FcaseId&saveURL=%2F_ui%2Fcore%2F&rtype=500&p2_lkid=contactId&email%2Fauthor%2FEmailAuthor?p3_lkid=caseId&template_id=emailTemplateId

Thats the url debugged

Thanks
Hello,

I have:

opportunity page, with standard and custom controller,

<apex:repeat value="{!$ObjectType.Opportunity.FieldSets.someOppField}" var="f">

<apex:outputLabel value="{!f.Label}" for="account__name2"/>
<apex:inputField value="{!Opportunity[f]}"  id="account__name2" />

</apex:repeat>

Everything is ok at this moment but then i try a second repeat with product fields,

<apex:repeat value="{!fields}" var="f">
                  <apex:inputfield value="{!merch[f.fieldPath]}"/>  
</apex:repeat>

and the code at the controller

public Product2 merch { get; set; }

public List<Schema.FieldSetMember> getFields() {
        return SObjectType.Product2.FieldSets.some_fieldset_at_producrt.getFields();
    }

It doesn´t work, it throws a javascript error, i´ve made some google on this error, it seems to be something with field type

More,

the three fields of the 'some_fieldset_at_product' are picklist

The javascript error:

Error: j_id0:j_id3:j_id29:j_id54:j_id55:0:j_id57: An error occurred when processing your submitted information.

Thanks
Hello,

I have a wrapper, <opportunity opp, boolean selected>

I iterate a list of wrapped opps build like this

checkbox - opportunity A
checkbox - opportunity B
checkbox - opportunity C

How can the controller get the id of the opportunity selected / unselected  ?

{var.opp.id} ??

script and apex function params ??

thanks
Hello,

I´ve to make a little funcionality where oAuth is used and after googling it I don´t know if I have an enormous problem or not problem at all.

Every information I find is related to authentication from the salesforce side but what I have to do is authenticate an external callout with an external oAuth endpoint.

It can be resumed this way:

External someone call myHttpPOST apex class method(which NOT includes oAuth flow)

This external wants me to authenticate his request so gives me an oAuth Url which I´ll have to request(POST ay ay), depending of the response, I´ll generate an adecuate response to the original request to my POST apex rest.

Then, I´ll have a POST apex method which receive a request and inside of my method I´ll have to make a POST request to an external URL because cannot have two apex post methods in the same class.

As I said, I´m not sure if I understood a word or I´m finding problems where there are not.

Thanks, regards

 
Hello

I have three scheduled jobs chained, one of them must be scheduled only if it`s the first day of the month.

This way:

Update all the Accounts, ten Accounts at a time managing a custom setting to re-schedule Account update job from the last Id processed, when the last Account is processed, then custom setting is updated to null and begin Update Contacts job...

Update Contact job is identical to Update Account Job, including the same custom setting to divide the execution in ten Contacts execution and then..

I have if (today.day == 1) then schedule a third job which updates Products, when its finished Account update job is scheduled to the next day

else (a different day than 1) I schedule Account update job to the next day and previously, custom setting is updated to null.


Well, there was a mistake in this code (I didnt do it :) ) because in the case its day 1, i dont update to null the custom setting so next day Contact job will begin to process from the last processed day 1, but this is not the problem I want to solve, although I can discard it`s related to my main issue.

Last, but not least, the code executes inside try-catch, sending an email in case of exception.

Well, my problem began at January 1st, from that day to day 15, execution of Contact jobs processed more or less 500 records(over a total of 30000) and then stopped, WITHOUT updating the custom setting causing the next day the first contact processed was the last processed the previous day. Day one were processed the contacts of index 1 to 500, second day 500 to 1000, third day 1000 to 1234, cause there are 1234 contacts at all, where the implementation is supposed to process every Contact every day.

What I really can`t understand and makes me go crazy is that in case of any error, updating custom setting, contact, null lists, whatever, an email is supposed to be sent to me and there was no email sent so there was not error or (crazy) there was an email error each day from January 1st to January 15th

Any ideas would be apreciated, and, yes, next time I`ll look for a better solution than chained jobs.

Regards and happy new year everybody
Hello,

I have to import a file and read it (and validate the data) but cannot.

It has ".dat" extension and can edit it with notepad without a problem but with <inputfile> the body (utf8 encoded)
of the file is an unreadable sequence of chars (bytes?).

If i edit the file.dat with an editor and save it as .csv, my code works perfect(even break lines stay) but, curious enough, if i simply change
the file.dat extension to csv, i obtain the same unreadable string.

The code:

<apex:page controller="c_CargaFicheroPedidoController">
   
     <apex:form >
        <apex:pagemessages /> 
        <apex:pageBlock >
            <apex:pageBlockSection columns="4">
                
                  <apex:inputFile value="{!csvFileBody}"  filename="{!csvAsString}" contentType="text/plain"/>

the controller

string dddfff = EncodingUtil.base64Encode(csvFileBody);

Thanks everybody



Hello,

I build an Url like this:

//s?cancelURL=%2FcaseId&saveURL=%2F_ui%2Fcore%2Femail%2Fauthor%2FEmailAuthor?p3_lkid=caseId&template_id=emailTemplateId&rtype=500&p2_lkid=contactId

Redirect

pagereference ....(urlBuild) ---------------> bum!

somehow between urlBuild and the disaster, two of the parameters travel from saveurl to cancelurl like this

//s?cancelURL=%2FcaseId&saveURL=%2F_ui%2Fcore%2F&rtype=500&p2_lkid=contactId&email%2Fauthor%2FEmailAuthor?p3_lkid=caseId&template_id=emailTemplateId

Thats the url debugged

Thanks
Hello,

I have:

opportunity page, with standard and custom controller,

<apex:repeat value="{!$ObjectType.Opportunity.FieldSets.someOppField}" var="f">

<apex:outputLabel value="{!f.Label}" for="account__name2"/>
<apex:inputField value="{!Opportunity[f]}"  id="account__name2" />

</apex:repeat>

Everything is ok at this moment but then i try a second repeat with product fields,

<apex:repeat value="{!fields}" var="f">
                  <apex:inputfield value="{!merch[f.fieldPath]}"/>  
</apex:repeat>

and the code at the controller

public Product2 merch { get; set; }

public List<Schema.FieldSetMember> getFields() {
        return SObjectType.Product2.FieldSets.some_fieldset_at_producrt.getFields();
    }

It doesn´t work, it throws a javascript error, i´ve made some google on this error, it seems to be something with field type

More,

the three fields of the 'some_fieldset_at_product' are picklist

The javascript error:

Error: j_id0:j_id3:j_id29:j_id54:j_id55:0:j_id57: An error occurred when processing your submitted information.

Thanks
Hello,

I have a wrapper, <opportunity opp, boolean selected>

I iterate a list of wrapped opps build like this

checkbox - opportunity A
checkbox - opportunity B
checkbox - opportunity C

How can the controller get the id of the opportunity selected / unselected  ?

{var.opp.id} ??

script and apex function params ??

thanks