• IceEngine
  • NEWBIE
  • 80 Points
  • Member since 2012

  • Chatter
    Feed
  • 3
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 8
    Questions
  • 14
    Replies

Hi all,

I used upsert sObject; statement , after executing this statement I need to know upsert is inserted or updated record

  • September 30, 2013
  • Like
  • 0

hi everyone,

i came up with a error when upload a file using Chrome. (yes, not IE)

when uploading, an error shows, but then refresh the page, the file uploaded successfully.

this error don't shows at chatter tab, but shows at Account feed, Contact feed.

 

any help would be appreciated!

Request URL:https://ap.salesforce.com/chatter/handlers
Request Headersview source
Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Content-Type:multipart/form-data; boundary=----WebKitFormBoundaryoXgeuyXh213NtnNr
Origin:https://ap.salesforce.com
Referer:https://ap.salesforce.com/0031000000PlXua
User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36
Request Payload
------WebKitFormBoundaryoXgeuyXh213NtnNr
Content-Disposition: form-data; name="chatterFile"; filename="20131210_093634_220.tif"
Content-Type: image/tiff


------WebKitFormBoundaryoXgeuyXh213NtnNr
Content-Disposition: form-data; name="fileName"

20131210_093634_220
------WebKitFormBoundaryoXgeuyXh213NtnNr
Content-Disposition: form-data; name="desc"


------WebKitFormBoundaryoXgeuyXh213NtnNr
Content-Disposition: form-data; name="hiddenFileName"

C:\fakepath\20131210_093634_220.tif
------WebKitFormBoundaryoXgeuyXh213NtnNr
Content-Disposition: form-data; name="shareOption"

pvt
------WebKitFormBoundaryoXgeuyXh213NtnNr
Content-Disposition: form-data; name="feedItemType"

ContentPost
------WebKitFormBoundaryoXgeuyXh213NtnNr
Content-Disposition: form-data; name="entityId"

0031000000PlXua
------WebKitFormBoundaryoXgeuyXh213NtnNr
Content-Disposition: form-data; name="feedItemVisibility"


------WebKitFormBoundaryoXgeuyXh213NtnNr
Content-Disposition: form-data; name="topicIds"


------WebKitFormBoundaryoXgeuyXh213NtnNr
Content-Disposition: form-data; name="feedType"

ENTITY
------WebKitFormBoundaryoXgeuyXh213NtnNr
Content-Disposition: form-data; name="q"

;postFile
------WebKitFormBoundaryoXgeuyXh213NtnNr
Content-Disposition: form-data; name="refreshRecentFiles"

false
------WebKitFormBoundaryoXgeuyXh213NtnNr
Content-Disposition: form-data; name="token"

XxVHXM7RplnlEGEmV7osBlxOwx2cmNf62_WKf6Q8YuWFGOi03GvWyBiZerXmaM7h1f7jEXdiGZTpBGCISTJp3CKgDs7oRtpy8PJvn1sf4SzFFMLt4crjiE1h53H9E1lojc3AyDuGkunGXJ.c_7a_J7Rxk6Q=
------WebKitFormBoundaryoXgeuyXh213NtnNr
Content-Disposition: form-data; name="fileName"

20131210_093634_220
------WebKitFormBoundaryoXgeuyXh213NtnNr
Content-Disposition: form-data; name="desc"


------WebKitFormBoundaryoXgeuyXh213NtnNr--

 

Request URL:https://ap.salesforce.com/chatter/handlers
Request Method:POST
Status Code:400 Bad Request
Request Headersview source
Accept:*/*
Accept-Encoding:gzip,deflate,sdch
Accept-Language:ja,en-US;q=0.8,en;q=0.6,zh-CN;q=0.4,zh;q=0.2,zh-TW;q=0.2
Authorization:xxxx
Connection:keep-alive
Content-Length:0
Cookie:web_core_geoCountry=jp; IS3_History=1386451449-1-55_0--1+1--1+5--1+7--1+10--1+18--1+25--1__0-1-5-7-10-18-25_; lastlist=/_ui/core/chatter/files/FileDetailPage; setupopen=; sid=00D10000000KCvW!ARMAQJqROF7VMuyIWQRRKAQVtnVcSm6xbgY4ma3O8qFZRjKBbUH32Zb7d_nHG1F.BSstVBQBIRdf6gtKPHg1s2cvT6j0vXBg; sid_Client=0000000wjoG0000000KCvW; clientsrc=113.36.149.11; oid=00D10000000KCvW; rememberUn=true; login=xxx@yyy.com; com.salesforce.LocaleInfo=jp; oinfo="c3RhdHVzPUZSRUUmdHlwZT0zJm9pZD0wMERFMDAwMDAwMGE1bzk="; sfdc_lv2="KxG83HhrFTMdewxwgtakJU9TRpu522YkBLTExcx+V7AVPHrtBwVF4wSLDSAgEAUQJBHtl8qQChix6Zqo5p9n8kkiDf+O7IQbMuKyAiFso9SxSJeQ3ymnzh8gy1R24QVTZZysGprdzBdasuRVIspCPFJw6GY1vGCLoZg3r0mZGNqkGgY3m45s6q"; disco=E:00DE0000000a5o9:005E0000000f2D3:0; autocomplete=1; webact=%7B%22l_vdays%22%3A1%2C%22l_visit%22%3A1386637878824%2C%22session%22%3A1386643243299%2C%22l_search%22%3A%22%22%2C%22l_dtype%22%3A%22Typed%2FBookmarked%22%2C%22l_page%22%3A%22APPX%3Aus%3Asetupmodule%22%2C%22counter%22%3A4%2C%22pv%22%3A23%2C%22f_visit%22%3A1386552061368%2C%22version%22%3A%22w172.1%22%2C%22customer%22%3A1386552061368%2C%22d%22%3A%2270130000000sUVq%22%2C%22l_cloud%22%3A%22No%20Cloud%22%2C%22seg%22%3A%22customer%3Ajp%22%2C%22db%22%3A%7B%22name%22%3A%22eiko%20design%20%26%20creation%20co%20ltd%22%2C%22size%22%3A%22%22%2C%22ind%22%3A%22manufacturing%3Amanufacturing%22%2C%22cmp%22%3A%22%22%2C%22aud%22%3A%22smb%3Amanufacturing%22%7D%2C%22doco%22%3A%7B%22name%22%3A%22%22%2C%22city%22%3A%22%22%2C%22size%22%3A%22%22%2C%22sales%22%3A%22%22%2C%22ind%22%3A%22%22%7D%2C%22elq%22%3A%2226482984-afd8-4040-a19a-ebd3379e28b1%22%2C%22developer%22%3A1386643243299%7D; s_vi=[CS]v1|29528D7E85489EA7-40000101200601D3[CE]; inst=APP1
Host:ap.salesforce.com
Origin:https://ap.salesforce.com
Referer:https://ap.salesforce.com/0031000000PlXua
User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36
X-Requested-With:XMLHttpRequest
Response Headersview source
Cache-Control:private
Content-Type:application/json; charset=UTF-8
Date:Tue, 10 Dec 2013 02:58:35 GMT
Transfer-Encoding:chunked

 

 

Helloeveryone,

In my Visualforce component, neither in javascript

function SReason(pSelVal) {
  if (pSelVal == "{!$Label.VF_PGHELP_0001}") {...}

  nor in controller

ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, Label.Portal_LAB_MSG_0051));

the shown value is the customLabel default language, not the user language.

But In my Visualforce Page, the translation works fine.

 

here is the thing i'have done already, 

1. active languages at Translation Branch.

2. set user to the right language.

3. add translations at customLabel.

 

i also add the language attribute in the header:  language="{!displayLanguageCode}" but it doesn't help.

 

so is there anything goes wrong?

any help would be much appreciated!

 

In my pageBlockTable, when the "Quantity" is changed, it would be a action and reRender this table,

when the table is rerenderd, the focus in this table would be lost, so i'm trying to re-focus the last element.

here is my code:

<apex:page controller="Mycontroller">
<script type="text/javascript">
   var elementFocus = null;
   function setFocus(){
       elementFocus = document.activeElement;
   }
   function retainFocus(){
       elementFocus.focus();
   }
</script>
 <apex:form >
   <apex:pageBlock>
      <apex:pageBlockTable value="{!wrappers}" var="wrapper" id="wtable">
         <apex:column headerValue="Quantity">
             <apex:inputField value="{!wrapper.sub.Quantity__c}" id="Quantity__c">
                 <apex:actionSupport event="onchange" action="{!doSomething}"

                     <!-- before take action, set current focus. oncomplete, retain that focus -->
                     onbeforedomupdate="return setFocus()" rerender="wtable" oncomplete="return retainFocus()">
                 </apex:actionSupport>
             </apex:inputField>
         </apex:column>
         <apex:column headerValue="SalesPrice">
            <apex:inputField value="{!wrapper.sub.SalesPrice__c}" id="SalesPrice__c"/>
         </apex:column>
      </apex:pageBlockTable>
   </apex:pageBlock>
 </apex:form>
</apex:page>

 i use javascript to retain focus, and the alert also shows the right id, but elementFocus.focus(); just don't work.

should i include some other script?

<script type="text/javascript">
   var elementFocus = null;
   function setFocus(){
       elementFocus = document.activeElement;
       alert(elementFocus.id);
   }
   function retainFocus(){
       alert(elementFocus.id); //when debug, it shows the same value as the id in setFocus()
elementFocus.focus(); } </script>

 Any help would be much appreciated!

Hi, as everyone knows when to delete a custom field, salesforce check the referenced source, such as Visualforce page, Apex class.
For example, if you want to delete [custom__c] field in an object, a deleteredirect.jsp page will show a list  that [custom__c] field has been referenced by, so that you couldn't delete it.

My problem is, I want to get the Referenced by List of all the fields in my Schema, but to delete all the fields one by one Manually is not a good way.

So is there a good solution?
Any help would be much appreciated!

Hi, everyone !

 

I'm trying to get RemoteSite infomation "URL" using Apex,

But i only found Metadata desc method using Metadata-API but not internal Apex code.

 

Any help would be much appreciated !
Thanks !

Hi, everyone!

 

I'm trying to convert a string to Shift_JIS, then encode it to base64, then make an outcall use base64 code,

 

So how to do the convert

I found base64Encode() and urlEncode() methods, but can't find Charset encode.

 

Any help would be much appreciated!
Thanks!

Hi,everyone!

    I'm trying to send a http request to a Japanese app, which require the Shift_JIS charset.

    so how to change the charset in the body, and also change here: <?xml version="1.0" encoding="Shift_JIS"?>

    Any help would be much appreciated!
    Thanks!

Hi!

I have a set of Fields should be update, please teach me how to do ,thanks!

 

Set<String> Fieldset = new Set<String>{'Fax','Website'};

account a1 = [select id,Fax,Website from account limit 1];
account a2 = [select id,Fax,Website from account limit 1 offset 1 ];

for (string Field1 : Fieldset ) {
     a1.Field1 = String.valueof(a2.Field1);       // Error : Invalid Field1 for SObject Account
     //update a1;
}

 

 

don't work in a loop

for(String field :fields)
{
accs[0].get(field) = accs[1].get(field); //Expression cannot be assigned (the get() Arguments should be Integer i) accs[0].field = accs[1].field; //Invalid field field for SObject Account }

and don't work just as a parameter

 

list<String> fields2 = new list<String>{'Fax','Website'};
accs[0].fields2[0] = accs[1].fields2[0];          //Invalid field fields2 for SObject Account

 

 can work when set  the exact Field Name

        accs[0].Fax = accs[1].Fax;   //List SObject Type
accs.Fax = accs.Fax; //SObject Type

 

 Regards

hi everyone,

i came up with a error when upload a file using Chrome. (yes, not IE)

when uploading, an error shows, but then refresh the page, the file uploaded successfully.

this error don't shows at chatter tab, but shows at Account feed, Contact feed.

 

any help would be appreciated!

Request URL:https://ap.salesforce.com/chatter/handlers
Request Headersview source
Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Content-Type:multipart/form-data; boundary=----WebKitFormBoundaryoXgeuyXh213NtnNr
Origin:https://ap.salesforce.com
Referer:https://ap.salesforce.com/0031000000PlXua
User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36
Request Payload
------WebKitFormBoundaryoXgeuyXh213NtnNr
Content-Disposition: form-data; name="chatterFile"; filename="20131210_093634_220.tif"
Content-Type: image/tiff


------WebKitFormBoundaryoXgeuyXh213NtnNr
Content-Disposition: form-data; name="fileName"

20131210_093634_220
------WebKitFormBoundaryoXgeuyXh213NtnNr
Content-Disposition: form-data; name="desc"


------WebKitFormBoundaryoXgeuyXh213NtnNr
Content-Disposition: form-data; name="hiddenFileName"

C:\fakepath\20131210_093634_220.tif
------WebKitFormBoundaryoXgeuyXh213NtnNr
Content-Disposition: form-data; name="shareOption"

pvt
------WebKitFormBoundaryoXgeuyXh213NtnNr
Content-Disposition: form-data; name="feedItemType"

ContentPost
------WebKitFormBoundaryoXgeuyXh213NtnNr
Content-Disposition: form-data; name="entityId"

0031000000PlXua
------WebKitFormBoundaryoXgeuyXh213NtnNr
Content-Disposition: form-data; name="feedItemVisibility"


------WebKitFormBoundaryoXgeuyXh213NtnNr
Content-Disposition: form-data; name="topicIds"


------WebKitFormBoundaryoXgeuyXh213NtnNr
Content-Disposition: form-data; name="feedType"

ENTITY
------WebKitFormBoundaryoXgeuyXh213NtnNr
Content-Disposition: form-data; name="q"

;postFile
------WebKitFormBoundaryoXgeuyXh213NtnNr
Content-Disposition: form-data; name="refreshRecentFiles"

false
------WebKitFormBoundaryoXgeuyXh213NtnNr
Content-Disposition: form-data; name="token"

XxVHXM7RplnlEGEmV7osBlxOwx2cmNf62_WKf6Q8YuWFGOi03GvWyBiZerXmaM7h1f7jEXdiGZTpBGCISTJp3CKgDs7oRtpy8PJvn1sf4SzFFMLt4crjiE1h53H9E1lojc3AyDuGkunGXJ.c_7a_J7Rxk6Q=
------WebKitFormBoundaryoXgeuyXh213NtnNr
Content-Disposition: form-data; name="fileName"

20131210_093634_220
------WebKitFormBoundaryoXgeuyXh213NtnNr
Content-Disposition: form-data; name="desc"


------WebKitFormBoundaryoXgeuyXh213NtnNr--

 

Request URL:https://ap.salesforce.com/chatter/handlers
Request Method:POST
Status Code:400 Bad Request
Request Headersview source
Accept:*/*
Accept-Encoding:gzip,deflate,sdch
Accept-Language:ja,en-US;q=0.8,en;q=0.6,zh-CN;q=0.4,zh;q=0.2,zh-TW;q=0.2
Authorization:xxxx
Connection:keep-alive
Content-Length:0
Cookie:web_core_geoCountry=jp; IS3_History=1386451449-1-55_0--1+1--1+5--1+7--1+10--1+18--1+25--1__0-1-5-7-10-18-25_; lastlist=/_ui/core/chatter/files/FileDetailPage; setupopen=; sid=00D10000000KCvW!ARMAQJqROF7VMuyIWQRRKAQVtnVcSm6xbgY4ma3O8qFZRjKBbUH32Zb7d_nHG1F.BSstVBQBIRdf6gtKPHg1s2cvT6j0vXBg; sid_Client=0000000wjoG0000000KCvW; clientsrc=113.36.149.11; oid=00D10000000KCvW; rememberUn=true; login=xxx@yyy.com; com.salesforce.LocaleInfo=jp; oinfo="c3RhdHVzPUZSRUUmdHlwZT0zJm9pZD0wMERFMDAwMDAwMGE1bzk="; sfdc_lv2="KxG83HhrFTMdewxwgtakJU9TRpu522YkBLTExcx+V7AVPHrtBwVF4wSLDSAgEAUQJBHtl8qQChix6Zqo5p9n8kkiDf+O7IQbMuKyAiFso9SxSJeQ3ymnzh8gy1R24QVTZZysGprdzBdasuRVIspCPFJw6GY1vGCLoZg3r0mZGNqkGgY3m45s6q"; disco=E:00DE0000000a5o9:005E0000000f2D3:0; autocomplete=1; webact=%7B%22l_vdays%22%3A1%2C%22l_visit%22%3A1386637878824%2C%22session%22%3A1386643243299%2C%22l_search%22%3A%22%22%2C%22l_dtype%22%3A%22Typed%2FBookmarked%22%2C%22l_page%22%3A%22APPX%3Aus%3Asetupmodule%22%2C%22counter%22%3A4%2C%22pv%22%3A23%2C%22f_visit%22%3A1386552061368%2C%22version%22%3A%22w172.1%22%2C%22customer%22%3A1386552061368%2C%22d%22%3A%2270130000000sUVq%22%2C%22l_cloud%22%3A%22No%20Cloud%22%2C%22seg%22%3A%22customer%3Ajp%22%2C%22db%22%3A%7B%22name%22%3A%22eiko%20design%20%26%20creation%20co%20ltd%22%2C%22size%22%3A%22%22%2C%22ind%22%3A%22manufacturing%3Amanufacturing%22%2C%22cmp%22%3A%22%22%2C%22aud%22%3A%22smb%3Amanufacturing%22%7D%2C%22doco%22%3A%7B%22name%22%3A%22%22%2C%22city%22%3A%22%22%2C%22size%22%3A%22%22%2C%22sales%22%3A%22%22%2C%22ind%22%3A%22%22%7D%2C%22elq%22%3A%2226482984-afd8-4040-a19a-ebd3379e28b1%22%2C%22developer%22%3A1386643243299%7D; s_vi=[CS]v1|29528D7E85489EA7-40000101200601D3[CE]; inst=APP1
Host:ap.salesforce.com
Origin:https://ap.salesforce.com
Referer:https://ap.salesforce.com/0031000000PlXua
User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36
X-Requested-With:XMLHttpRequest
Response Headersview source
Cache-Control:private
Content-Type:application/json; charset=UTF-8
Date:Tue, 10 Dec 2013 02:58:35 GMT
Transfer-Encoding:chunked

 

 

Hi all,

I used upsert sObject; statement , after executing this statement I need to know upsert is inserted or updated record

  • September 30, 2013
  • Like
  • 0

Hello,

Please help me to resolve an issue. I have created a page which will display all the fields name of an object and a comment box in a apex:page table. 

An object name as Trans__c have four fields : Language__c, Field__c, Comment__c and object__c. All are Text (320) field.

This link hold the attachment of screenshot of the requirement: https://ap1.salesforce.com/sfc/p/90000000hbAW/a/90000000PKFg/9n6p89F57h.kA5Kdcztjura0UeX260kYIrFYm56btD0=

 

Now requirement is get those field values from Visualforce page and store them as records. So when Save button will be clicked Number of records (for those fields where comment is not null) will be saved at a time. So if two fields having comments then two records will be saved at a time if save button is clicked. (Map as: Fields Name-->Fields__c, Comment-->comment__c, Language--> Language__c, Object Name-->object__c

 

Codes Are shared via link: https://ap1.salesforce.com/sfc/p/90000000hbAW/a/90000000PKFl/kbu6qs0sznPu7XISKu_F9d6WtdAxXW8HcjQtWweX6ys=

 

My issue is I am unable to get the Vales in Wrapper Class which consists Two list of strings. And Can't insert those values as records.

 

Please help me to resolve this issue.

 

Thanks and Regards

Debajyoti Mondal

Helloeveryone,

In my Visualforce component, neither in javascript

function SReason(pSelVal) {
  if (pSelVal == "{!$Label.VF_PGHELP_0001}") {...}

  nor in controller

ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, Label.Portal_LAB_MSG_0051));

the shown value is the customLabel default language, not the user language.

But In my Visualforce Page, the translation works fine.

 

here is the thing i'have done already, 

1. active languages at Translation Branch.

2. set user to the right language.

3. add translations at customLabel.

 

i also add the language attribute in the header:  language="{!displayLanguageCode}" but it doesn't help.

 

so is there anything goes wrong?

any help would be much appreciated!

 

In my pageBlockTable, when the "Quantity" is changed, it would be a action and reRender this table,

when the table is rerenderd, the focus in this table would be lost, so i'm trying to re-focus the last element.

here is my code:

<apex:page controller="Mycontroller">
<script type="text/javascript">
   var elementFocus = null;
   function setFocus(){
       elementFocus = document.activeElement;
   }
   function retainFocus(){
       elementFocus.focus();
   }
</script>
 <apex:form >
   <apex:pageBlock>
      <apex:pageBlockTable value="{!wrappers}" var="wrapper" id="wtable">
         <apex:column headerValue="Quantity">
             <apex:inputField value="{!wrapper.sub.Quantity__c}" id="Quantity__c">
                 <apex:actionSupport event="onchange" action="{!doSomething}"

                     <!-- before take action, set current focus. oncomplete, retain that focus -->
                     onbeforedomupdate="return setFocus()" rerender="wtable" oncomplete="return retainFocus()">
                 </apex:actionSupport>
             </apex:inputField>
         </apex:column>
         <apex:column headerValue="SalesPrice">
            <apex:inputField value="{!wrapper.sub.SalesPrice__c}" id="SalesPrice__c"/>
         </apex:column>
      </apex:pageBlockTable>
   </apex:pageBlock>
 </apex:form>
</apex:page>

 i use javascript to retain focus, and the alert also shows the right id, but elementFocus.focus(); just don't work.

should i include some other script?

<script type="text/javascript">
   var elementFocus = null;
   function setFocus(){
       elementFocus = document.activeElement;
       alert(elementFocus.id);
   }
   function retainFocus(){
       alert(elementFocus.id); //when debug, it shows the same value as the id in setFocus()
elementFocus.focus(); } </script>

 Any help would be much appreciated!

Hi, as everyone knows when to delete a custom field, salesforce check the referenced source, such as Visualforce page, Apex class.
For example, if you want to delete [custom__c] field in an object, a deleteredirect.jsp page will show a list  that [custom__c] field has been referenced by, so that you couldn't delete it.

My problem is, I want to get the Referenced by List of all the fields in my Schema, but to delete all the fields one by one Manually is not a good way.

So is there a good solution?
Any help would be much appreciated!

Hi,everyone!

    I'm trying to send a http request to a Japanese app, which require the Shift_JIS charset.

    so how to change the charset in the body, and also change here: <?xml version="1.0" encoding="Shift_JIS"?>

    Any help would be much appreciated!
    Thanks!

Hi!

I have a set of Fields should be update, please teach me how to do ,thanks!

 

Set<String> Fieldset = new Set<String>{'Fax','Website'};

account a1 = [select id,Fax,Website from account limit 1];
account a2 = [select id,Fax,Website from account limit 1 offset 1 ];

for (string Field1 : Fieldset ) {
     a1.Field1 = String.valueof(a2.Field1);       // Error : Invalid Field1 for SObject Account
     //update a1;
}

 

 

don't work in a loop

for(String field :fields)
{
accs[0].get(field) = accs[1].get(field); //Expression cannot be assigned (the get() Arguments should be Integer i) accs[0].field = accs[1].field; //Invalid field field for SObject Account }

and don't work just as a parameter

 

list<String> fields2 = new list<String>{'Fax','Website'};
accs[0].fields2[0] = accs[1].fields2[0];          //Invalid field fields2 for SObject Account

 

 can work when set  the exact Field Name

        accs[0].Fax = accs[1].Fax;   //List SObject Type
accs.Fax = accs.Fax; //SObject Type

 

 Regards