• Dodi
  • NEWBIE
  • 405 Points
  • Member since 2009

  • Chatter
    Feed
  • 16
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 44
    Questions
  • 85
    Replies

Hello, I am working on a test involving the passing of variables. Basically, a user is on a splash page where they input some values in an HTML form, which are then passed to my Apex page to be used as parameters in Java Functions.

 

I am new to this, so I've created a simple test. I set up a Splash Page where a user uses a dropdown to select the make of a car. Based on their selection, this parameter is passed to my Java-Interacting Apex Page.  So far, I got this part working as the parameter of my HTML form was in my URL:

http://a.salesforce.com/apex/CarSales?carmake=Ford

 

Now, this is where I"m getting stuck. I want to use my apex Page to send this variable to one of my Apex Classes where it will call a Java Function.

 

Here is the Apex Code I have from the web interface. carmake represents the variable that was passed from the previous HTML form.

<apex:page controller="Cars">
{!getMake(carmake)}
</apex:page>

 Here is my Cars Class

public class Cars
{

String make;
    
    public String getMake(String c)
    {
        if (c == 'Ford')
        {
             make = 'You have selected Ford';
        }

        else
        {
             make = 'You have not selected Ford';
        }

        return make;
    }
}

 

 

However, the variable carmake does not seem to be recognized, as I am getting the error:

Error: Unknown property 'Cars.carmake'

If anyone could provide any insight, I would really appreciate it.

Thank you,

Mike

I want to develop sample applications using REST API and Force.com IDE platform. Is there a sample applicaiton with code available online that does so or how can I do it. I cannot seem to find a full-fledged sample applciaiton that utilizes REST too.

 

 

Hi all,

Informatica documentation describes the process of setting up web service connections as shown below.  Does any one know if this will work with an apex webservices exposed from a salesforce org?  Has anyone tried this?

 

There is a seperate process for "PowerExchange for Salesforce Connections", but I believe this exposes calls available through the partner api only (i.e. not a custom written web service).

 

---------------------------

 

 

PowerExchange for Web Services Connections

The Integration Service can use Web Services Consumer application connections to extract data from web service sources, write data to web service targets, or transform data using Web Services Consumer transformations. Web Services Consumer application connections allow you to control connection properties, including the endpoint URL and authentication parameters.

To connect to a web service, the Integration Service requires an endpoint URL. If you do not configure a Web Services Consumer application connection or if you configure one without providing an endpoint URL, the Integration Service uses the endpoint URL contained in the WSDL file on which the source, target, or Web Services Consumer transformation is based.

Use the following guidelines to determine when to configure a Web Services Consumer application connection:

*
Configure a Web Services Consumer application connection with an endpoint URL if the web service you connect to requires authentication or if you want to use an endpoint URL that differs from the one contained in the WSDL file.
*
Configure a Web Services Consumer application connection without an endpoint URL if the web service you connect to requires authentication but you want to use the endpoint URL contained in the WSDL file.
*
You do not need to configure a Web Services Consumer application connection if the web service you connect to does not require authentication and you want to use the endpoint URL contained in the WSDL file.

If you need to configure SSL authentication, enter values for the SSL authentication-related properties in the Web Services application connection. For information about SSL authentication, see the PowerExchange for Web Services User Guide.

To create a Web Services Consumer application connection:

1.
In the Workflow Manager, connect to a PowerCenter repository.
2.
Click Connections > Application.
The Application Connection Browser dialog box appears.
3.
From Select Type, select Web Services Consumer.
4.
Click New.
The Connection Object Definition dialog box appears.
5.
Enter a name for the application connection.
6.
Enter the following connection information:
Connection Attributes
Description
User Name
User name that the web service requires. If the web service does not require a user name, enter PmNullUser.
To define the user name in the parameter file, enter session parameter $ParamName as the user name, and define the value in the session or workflow parameter file. The Integration Service interprets user names that start with $Param as session parameters.
Use Parameter in Password
Indicates the web service password is a session parameter, $ParamName. If you enable this option, define the password in the workflow or session parameter file, and encrypt it using the pmpasswd CRYPT_DATA option. Default is disabled.
Password
Password that the web service requires. If the web service does not require a password, enter PmNullPasswd.
Code Page
Connection code page. The Repository Service uses the character set encoded in the repository code page when writing data to the repository.
End Point URL
Endpoint URL for the web service that you want to access. The WSDL file specifies this URL in the location element.
You can use session parameter $ParamName, a mapping parameter, or a mapping variable as the endpoint URL. For example, you can use a session parameter, $ParamMyURL, as the endpoint URL, and set $ParamMyURL to the URL in the parameter file.
Domain
Domain for authentication.
Timeout
Number of seconds the Integration Service waits for a connection to the web service provider before it closes the connection and fails the session. Also, the number of seconds the Integration Service waits for a SOAP response after sending a SOAP request before it fails the session.
Trust Certificates File
File containing the bundle of trusted certificates that the Integration Service uses when authenticating the SSL certificate of the web services provider. Default is ca-bundle.crt.
Certificate File
Client certificate that a web service provider uses when authenticating a client. You specify the client certificate file if the web service provider needs to authenticate the Integration Service.
Certificate File Password
Password for the client certificate. You specify the certificate file password if the web service provider needs to authenticate the Integration Service.
Certificate File Type
File type of the client certificate. You specify the certificate file type if the web service provider needs to authenticate the Integration Service. The file type can be either PEM or DER. For information about converting the file type of certificate files, see the PowerExchange for Web Services User Guide.
Private Key File
Private key file for the client certificate. You specify the private key file if the web service provider needs to authenticate the Integration Service.
Key Password
Password for the private key of the client certificate. You specify the key password if the web service provider needs to authenticate the Integration Service.
Key File Type
File type of the private key of the client certificate. You specify the key file type if the web service provider needs to authenticate the Integration Service. PowerExchange for Web Services requires the PEM file type for SSL authentication. For information, see the PowerExchange for Web Services User Guide.
Authentication Type
Select one of the following authentication types to use when the web service provider does not return an authentication type to the Integration Service:
-
Auto. The Integration Service attempts to determine the authentication type of the web service provider.
-
Basic. Based on a non-encrypted user name and password.
-
Digest. Based on an encrypted user name and password.
-
NTLM. Based on encrypted user name, password, and domain.
Default is Auto.
7.
Click OK.
The application connection appears in the Application Connection Browser.
Hi all, I have a requirement where we access pdf docs from a third party web service that stores them. I am trying to bring these back into Salesforce as attachments and I have a call out that passes in the request xml and receives a response ok. Question is how do we access the binary attachment section of the response? The attachment is outside the soap envelope and trying to figure out how to get to it so I can load it as an attachment. 

<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
   <S:Body>
      <ns2:DocDNAExtractResponse xmlns:ns2="http://hq-srames-lt.lason.com/DocDNAWS/">
         <Result>
            <ResponseXML><![CDATA[<RESPONSE>
<DOCS_FOUND>3</DOCS_FOUND>
<DOCS_EXTRACTED>3</DOCS_EXTRACTED>
</RESPONSE>]]></ResponseXML>
            <StatusXML>&lt;STATUS>SUCCESS&lt;/STATUS></StatusXML>
            <Documents>
               <IndexDetails>PSC_GENID    PSC_GENNME    PSC_CUSTID    PSC_CUSNME    PSC_SDOCID    PSC_ORDNUM    PSC_GENSDT    PSC_TSDFSD    PSC_IDOCID    PSC_DOCTYP    PSC_DOCID    PSC_MANFLG    PSC_SCNDTE    Pages</IndexDetails>
               <FileAttachmentList>
                  <FileName>83115e33-015e-4d09-9bdf-bfda3a93424e-000001.pdf</FileName>
                  <Attachment>
                     <xop:Include href="cid:b5a0b95f-9f14-41b1-85af-dab89be0561b@example.jaxws.sun.com" xmlns:xop="http://www.w3.org/2004/08/xop/include"/>
                  </Attachment>
               </FileAttachmentList>
            </Documents>
         </Result>
      </ns2:DocDNAExtractResponse>
   </S:Body>
</S:Envelope>



HTTP/1.1 200 OK
Date: Wed, 10 Jun 2015 19:02:27 GMT
Transfer-Encoding: chunked
Content-Type: multipart/related;start="<rootpart*7ae4c202-67e8-4e07-8a57-0034174bd098@example.jaxws.sun.com>";type="application/xop+xml";boundary="uuid:7ae4c202-67e8-4e07-8a57-0034174bd098";start-info="text/xml"
Set-Cookie: JSESSIONID=jj7QV4JD4Z1MB2TDBrGnT49K56KK0RRvqBZYSjlXYjf3nkLWClnQ!2091688840; path=/; secure; HttpOnly
X-Powered-By: Servlet/2.5 JSP/2.1
Set-Cookie: BIGipServerDNA_Securevault_pool=3154379274.22811.0000; path=/

--uuid:7ae4c202-67e8-4e07-8a57-0034174bd098
Content-Id: <rootpart*7ae4c202-67e8-4e07-8a57-0034174bd098@example.jaxws.sun.com>
Content-Type: application/xop+xml;charset=utf-8;type="text/xml"
Content-Transfer-Encoding: binary

<?xml version='1.0' encoding='UTF-8'?><S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"><S:Body><ns2:DocDNAExtractResponse xmlns:ns2="http://hq-srames-lt.lason.com/DocDNAWS/"><Result><ResponseXML>&lt;RESPONSE>&#xd;
&lt;DOCS_FOUND>3&lt;/DOCS_FOUND>&#xd;
&lt;DOCS_EXTRACTED>3&lt;/DOCS_EXTRACTED>&#xd;
&lt;/RESPONSE>&#xd;
</ResponseXML><StatusXML>&lt;STATUS>SUCCESS&lt;/STATUS></StatusXML><Documents><IndexDetails>PSC_GENID    PSC_GENNME    PSC_CUSTID    PSC_CUSNME    PSC_SDOCID    PSC_ORDNUM    PSC_GENSDT    PSC_TSDFSD    PSC_IDOCID    PSC_DOCTYP    PSC_DOCID    PSC_MANFLG    PSC_SCNDTE    Pages&#xd;
</IndexDetails><FileAttachmentList><FileName>83115e33-015e-4d09-9bdf-bfda3a93424e-000001.pdf</FileName><Attachment><xop:Include xmlns:xop="http://www.w3.org/2004/08/xop/include" href="cid:b5a0b95f-9f14-41b1-85af-dab89be0561b@example.jaxws.sun.com"/></Attachment></FileAttachmentList></Documents></Result></ns2:DocDNAExtractResponse></S:Body></S:Envelope>
--uuid:7ae4c202-67e8-4e07-8a57-0034174bd098
Content-Id: <b5a0b95f-9f14-41b1-85af-dab89be0561b@example.jaxws.sun.com>
Content-Type: application/octet-stream
Content-Transfer-Encoding: binary

%PDF-1.4
%����
2 0 obj
<</Length 40>>stream
q 1287.75 0 0 1679.25 0 0 cm /Im1 Do Q

endstream
endobj
4 0 obj
<</DecodeParms<</K -1/Rows 2239/Columns 1717>>/Type/XObject/Subtype/Image/ColorSpace/DeviceGray/Width 1717/BitsPerComponent 1/Length 53021/Height 2239/Filter/CCITTFaxDecode>>stream
&�d� `�9 a��r1��9�ßpWr������T2����
���ʒV@� �sa�9 A�#r9�0�Ð����4�0��I�7rC�rsa�Q�9�0�s�w;�s�Pu�
/�5A��0�r1��0��sa�9';��)�9��$)!��T��3�ʃ����c��n�s�)�\��C 6�3�ra�Q�;�
s�� �rs��Ürr 㑎B�a�9�Øsg$��DDDDDDDDDDDDDDDDy@A��0�(�3�a�Q�9�;��a��;��Øs�'$9�㑎a�9�0�Ð0�2�0�sw;�s�܌r7Mb"""""""S�x����.�d|�"""""<�@���s@�r
#�H���9�0�Øsw?��6I2�9Y��� �YNq�9�0� �s�ey�0�nTyZ�����9��?9Vw;����:Φ��hȺ+�"t]��[����Dw�#�N�J��tG��Q$��]���"-�2Vf����F!&��H����q2e�< ˳_L�6͑��q�D�s8f��.F�r.k��SM4�l}s�s�*/�����e�A��O�M>�����������������b�����G��{��_�������2�&P/�=������_����J���Ȕ�8��������������/_���w�����(������������y�*���������w)?ˠؐ����_������$��TG����������i7�h~���������������������A����������-��)������������EK:唗��+��������w�F�_���_�������DE���to�z������o���WX�����������&�J��֛���_�_������!u������������%����������u�����������"@c�����������������������_������%���������� �#�}���_�������"?����������������������fW����_�������~�z���������𽮷���������q�����������H�G��u�������������������}�u���������u���������'z�����������S��_������_���������������]������r!��l/���W����׿�[I��������������u����������__�����~Y�������������|�f�>>�����{����e�F�0�_�����������nd�ß"��j�k吺�������_���a�;    ��w����
tgVH"��    ������������i�anHz�$xA��P��c���������u�!��શ���E �'��������������~5K�Ó�XN����UUS������������d-']���u&�N�P�P������u����^�O|?��-�#I=8P�8Zs�/����������D�+�&=~�����V������������oA���X_��a��_⡯�����������P����#��y��ܘ������������K��Zֹ�l���������~���;����U��Lj����������{�,�O_�/�q�����������x�9 �%����{%l�i�����������^S��pOK_����������AV�W���]o��������ֿ��qn���xRZut������������������K+�_DM����Y�_�_���������մ������6����}���������&�P�D=���Xk־�t�����������_��;[lV��?��]'[�n�_���_�W��Ѝ4�]SM~;k!�>K�_���������i�� �'��5�=J����_��������    ��hDDk�����������8�kk
?����_������`�DԄNŗ��������������������������������}{ ������������������������������������������d�����������������������������������{������������޿����%��4 &���w����v�B"""#�"""""""""""""?���:���<~%���3�
4~M�3������E�\!)gw��ǙqM�4�F�=|�F��³腢�)�_/���SGfyT��]�X��1�h���M��7Oߝ�2f�yYq->�H,����`�A���o_���=5��}RlV��ҽ_���������ʑ������3Y;8�E��/Dv`�3��<?��8uT�V������S�Q�Ǚ��m�3���2s63B��%�3~��E�E�px<�����s� B��반�{�XJ��/�3�l�r6��(�;#���8��͙�f� �$F�5�i}���?�F����?�==g��p�;S\���-�ܷr��F��]���g�����o_W��T��#�G�
k�Zuh��@��hϖ�4i0�(�ѡ��o�&��}�3���M����5�R���_�M�6G�n����&�������ѝ�gs;��o�gp�f�3�xu3��ѣO�ֿ�_��ӯ����C�}k�����W�������n�'�w�s�ه�     j�>4��_O���k"��kI���د�ۯ��𑻏��{���q2���������8���~������f��������?������}�����~�~����!���������_��0�Yu���������������l���0�����!����������⦟ׯ��ԏw��u��q��7����0���������
�����~����i���]�������zz�������?���_:��������۽z�J�_����������{�������щ&*�8��د��>�������G��)�u�������v�����������K��b�Э��K�M5L ���)�_�1������+1��u_�\ƞ��aX��6)���?�)�b��*��������~�*�����a4�S�B"#�?���ݮ����N>?c�����������ߦ�������ܣ�� ������b��!u�GM� �����������3������CS#��_�ȷ���gb>� �ת_8����ݡ&�`AՑ�]���9�dc8�f�+�a�6OC��Ghl0
fap����h����Y���6:
�`T�th_�DD��(@�`r?;t[
��a�gsq�r�V�׵ f
���
��}�;�ʂ��JfVs��B�([u"f�9N@��e�܁A���`���]E���    W����,sO$Gb�w�o��C6ȉ4,��E&o)*�2�H�kz �*
�k�FZ����Ԉ* ��3�eG�靅�轧4f��� /���#ˣC����.����Hϣ��=��F�_1�&b=-���>�D~���z>��
�o���sq�9�'��3��x ˙r6͑�_6���a3L �!� ���qa;͇    �L���)pKL��s��(vn>����IapM����e�xN�B-#ԩ��H���A�v���};��Պ����_���.4˒j�'���]��H��þwu�,s>�����g�9�ִ�љ�ϙ�)zI<ϙ�?��>a�3���h�0��ǣ>��X�0�_������F{H��Z��9����-+ ����ե����#��u8��x���|a����t�����~>����U~����}{֔P��������׾���z�����Dy��ő��Ov���{��`������������>������?��Pa��a�4��W0�_�M���{��?�V�U�4}?ۏ�������KF�������΁�ቑ��}��&�4���_�#�����_�:�s1�E� �6͙��p�8�"Y�M4Xy���g������%�{������ϫ^�?�x"?�F?��<��������/������������^��������c�����^߳����z������/�0�����o�ݏ�8����E���-�&��p��}�)������?����66=��D�ű��:ݍ���s��~��~�o��^���_������4������t�����x���w��^*#���v�iݧv��M a0�4"M�a��� !g�B""���0�������������b��*��}��OM4
2㈈��DqG�"8�!�DP�������$��o �qY-K�^������ƋS>���E�<WV�����D0�������-W�q�S��Z��%�Z���������L|َ��w�����j�ѝ��4��k���y�ɰ`���2���u_�׷���5�9���3�̆D1N��`�    ��뿶���T]��&�������B @�B ��O������"���b����M}4v������O�[YWc馚U��O����[����    ��ap���5^Eƈ��������E�D��Y+�fJ܎n��;�O�u �ui>��L����[����Uuw��GL࿨0��KK����G+ ��|�L�vvH2s'�ڥ$?�J�?��i��C���!�@�L ��Z���}�t/��1fNPd�NF�Cd�fD6fXA�׿A��A��%���%��w �    �v�������U�^���w֣o��5�M4�US����mI�D�.ܛ���׵J����iɏDݪ�n����rs(w.�P�Z����J���6�#1�\!�6�G�q�������;�����Ӫӭ7�z_I?]j8���u%��#
���4�U�׿O�iw�����̂�5��")��=�M���M�*ſ�#<���ת}�I���I��1�0�.����mUu�
30��ksJ�#    J�C�=2XEgf;���p�#�:+(F�\z��E������4�ꉏU_��W�w%h��"Q���ֻ����i7���-�^F�ү~������b���D����Dv=zX�*W�"8�_֖:GO�q��\���2?W_��u�_�7饼���>N����?� �O�ү��a�!'Y���%�� ^�����K��7�֩S~��k�fJ������=�}�M�"Ç��_������7�z��w�}��-��JK���]��� C�7�Eˏ��������N��C��V�P���+�����
��0���/G����wտ������e    /�ix�ؤ�_i���3�O�*4��o{կQ��K����ޛ�~Ӵ׾��a��w�����U߯��0?�����u�H
b����M}l,0����m��M���a���v��ujNe
I���%kد�+�)��    ��0��h0D#��x'���=_�H�M��G�VǴ;�^���U�a:��v>��[i��ޝ����^O�    �h0�A��������O�׆�m4Ӵ�4���F�DDG��xB�-DDA�!�|�w��"#�_��������a������������!2�.!�GE�&��G�����EX�لk�s��L
@���8����o��ԁ(� A9���e��?��j�HB�C�M���
�[R��!����C9Mfڳ�Pqs2���A�����Y� �]��2|��D��1Ta�B3Do��2��P��dI�-�_�0��ծ��i����:g2e��eT�E�ӊi���?��K~���n�7b��s63��vl�v]�3�|��3 �.͚�L����P���[��o��
3�h$�O    ��U;�q�ޚ�wv���
`�e��l���ˌ�ds    �?�����ܦ/9�#�Nytr6Y��˙�0z_���F{H��#=��]���ў��jx[;�gp����X�wwh_�@��H~� D{��D�6H3 �a3?    �
�2�0?0G���D}%�"<����_�b��ߺ��k�����i��|�g��;��<ϙ�8Uj��|�)�;�'w�l<o�ݣ�F}������w�<g�*�F~`���O�l��ҫ
���},{�?k���qB��w����W�=.�0D{��W�g���o_�+��G����X��~6�����[�_�/�D��>���5t�����U�Oڏ8���Ն��#�6Q��=����1�o���������z3��0��|o�x/����0_��`������ 7�u����4����������/�ȇ��<7Q��7�F�� ���џ���1�߂)߄P���]��:b��r���]={/S��}u���?��>�����~o������}���T0ECmc�^8��ba�Ʊ�����b�����"<����"<����_���]ֽ�{���0����">�6����B�!=;���Mm4�{$馃^�$�i����s��~��s��cccb���w�ڗ�\��G�[���t�x����☙�0�DDDDDDDDDDlDDDDDDE�P�B"�=�`��L&W��1^�q�ӵ��Q��zi�q�ӴQ�p�    �Y��E'��0�a;B"Ͱ��O�����F*��0�� !����������-!�E2���4l>��C�_�c    �31�?���ft#�f`�Gf��>��aa5�k!a�H�9 S�8.C�<!�8@�
4-=>�?^����p`�� �0�L�]띣%�2t“�n�8jd�ߘ�����E����3m;L�rL���$��Dh3�#�;�"�"$�����D�1LV��Zɖv����H���T��EQ#����CI�#w!��zl'D�[��� �Ϗ3�A�fu��"�O    ���C""Jqűk�Ċ'�A�'�<ԟF_w���"#���rc�Gֿ���'�
�᪫��?���% ���4�}~���    k�c��yc��>��{��c�����B}[��_W���u���Idu��&��饫���i���q�;������}.���tN�_�h�t����9p��V+��[��U�D1���q}�h�N������� ޿������~����4�e�i�������]�_���V���Z}��]�~�a�D!�D����������H���ʉ�K�c�_�TT��^�� {k���I�o�O��ݯ����K�C��+c�_��+��0���A����kߥ�������B1�C0�?����^J�5T�T�MS������p�v��T!DDDDDo��DDDDD�����������/�'F��׿�Ó��8a3;�9�UY�]�3���kH��9�>f��� ς��̌ȢM4�Z���zA�����%2��B|��] r�1�\�q�a0�z���U��ǧ��T�&�i�i�v���MiQ1ܞ�w�������uO����0:~�.��j���������$�;�J�̘4d��vN�i��p�;�p´���.)s3#�A��pS��)v`������4Q4h?�hC����_��n%�B,&O�N#A��3��~�_�Aiw[�_H�Lz��=����$�_������c��Ɏ�������[��G�c�
w��=o��c���    ����X�4M��˿�A�� �c�{����L.�a<���vM˰���X�?���a�c�}� � ��گ��]��1ߎ�z���׽��^����[�u��Lq��/Mq�ԖO    ��oi_���
  • June 10, 2015
  • Like
  • 0

Dear Gurus,

 

I have a trigger that I am doing some summary counts on some lookup records(non master detail). My trigger processes fine with the trigger.new records. I am having trouble properly running the same process against a value in the trigger.old context. Since the trigger does not persist to the database prior to the entire trigger completion, I think my aggregate results are the same for both calls to the trigger utility class. How can I process the trigger.old request(second line in the trigger) against the records after they have updated. I am trying to update/refresh the old record count on the Trailer object with the correct count value after the new records are updated. Any help is appreciated....current code is below:

 

trigger ManifestUpdateTrailerContainerInfo on Manifest__c (after delete, after undelete, after update) {

    ManifestContainerInfoTriggerUtil.updateContainerCounts(Trigger.New);
     ManifestContainerInfoTriggerUtil.updateContainerCounts(Trigger.Old);

}

 

 

public with sharing class ManifestContainerInfoTriggerUtil {
    
    public static void updateContainerCounts(List<Manifest__c> lstManifest)    {
        
        Integer containerCount = 0;
        id trailerToUpdate;
        List<Trailer__c> lstTrailersToUpdate = new List<Trailer__c>();
    
        //new trailer collection
        Set<Id> ids = new Set<Id>();
    
          for (Manifest__c mf : lstManifest) {
              ids.add(mf.id);
          }
          
        //new counts
        AggregateResult[] counts = [SELECT Manifest__c ,count(id)containers FROM Container__c WHERE Manifest__c IN :ids GROUP BY Manifest__c];
        
        for(AggregateResult ar : counts){
            for(Manifest__c m: lstManifest){
                if(ar.get('Manifest__c') == m.Id && m.Trailer__c != null) {
                     trailerToUpdate = m.Trailer__c;
                    containerCount = integer.valueof(ar.get('containers'));
                    lstTrailersToUpdate.add(new Trailer__c(Id=trailerToUpdate, Container_Count__c = containerCount));
                }
            }
        }
        update lstTrailersToUpdate;
    }
        
}

 

  • November 07, 2013
  • Like
  • 0

I am trying to use some code from this post. I am trying to write a trigger that allows for bulk processing of counting attachments associated to a record based on the record change(not addition of the attachment). Below is my code that compliles, but I get a runtime error "Apex trigger WasteProfileAttachmentCount caused an unexpected exception, contact your administrator: WasteProfileAttachmentCount: execution of BeforeUpdate caused by: System.DmlException: Update failed. First exception on row 0 with id a0fa0000006j8IAAAY; first error: SELF_REFERENCE_FROM_TRIGGER, Object (id = a0fa0000006j8IA) is currently in trigger WasteProfileAttachmentCount, therefore it cannot recursively update itself: []: Trigger.WasteProfileAttachmentCount: line 30, column 1"

 

I understand that I am not supposed to explicitly call update, on the same record. But how can I update in bulk?....below is the code.

 

trigger WasteProfileAttachmentCount on ProfileDocument__c (before update) {

    Set<Id> ids = new Set<Id>();
    ids.addAll(trigger.newMap.keySet());
    
    AggregateResult[] counts = [SELECT ParentId,count(id)attachments FROM Attachment WHERE ContentType = 'application/pdf' AND ParentId IN :ids GROUP BY ParentId];   
    
    List<ProfileDocument__c> toUpdate = new List<ProfileDocument__c>();
    
    for(AggregateResult ar : counts){
        ProfileDocument__c tempDocs = new ProfileDocument__c(Id=string.valueof(ar.get('ParentId')),Attachments__c=integer.valueof(ar.get('attachments')));
        toUpdate.add(tempDocs);
    }
    
    update toUpdate;

}

  • August 14, 2013
  • Like
  • 0

Hi I have a visual force page which has a table of records to be processed. Most everything works as expected except one minor issue.

 

I am trying to display an alert message via the jave script "Alert"  function below. The message displays as expected, but the variable for {!workOrderCount2Remove} does not change in the jave script "alert" function. However the variable changes as expected when I reference it directly in my output panel with the vf form. I am guessing because this is processed server side but the java script runs in the browser and the variable is not resetting for some reason. So how can I accomplisth this without a refresh? My rerendering works for the tables and panel, only the variable callerd in the java script is set on the initial page load and never again without a refresh. Hope this issue makes sense.

 

Thanks

 

 

<apex:page controller="ManifestMaintenanceController">
<script type="text/javascript">
    function checkAll(cb,cbid)
        {
            var inputElem = document.getElementsByTagName("input");                    
            for(var i=0; i<inputElem.length; i++)
            {            
                 if(inputElem[i].id.indexOf(cbid)!=-1){                                       
                    inputElem[i].checked = cb.checked;
                }
            }
        }
        </script>
        
 <script type="text/javascript">
    
    function alert() {

    var myVar = '{!workOrderCount2Remove}';
     
   if (  '{!workOrderCount2Remove}' == 0 ) {
        alert('There are no manifest lines available to remove. MyVar = ' + '{!workOrderCount2Remove}');
    }
    else {
        alert('MyVar Count is ' +  '{!workOrderCount2Remove}');
          myVar = 0;
    }
        }
      
     
</script>



      <apex:form >
    
          <apex:pageBlock >
              <apex:pageBlockButtons >
                  <apex:commandButton value="Remove from Manifest" action="{!processRemoveSelected}" rerender="table, panel"  onclick="alert();" />
                  <apex:commandButton value="Return to Manifest" action="{!pageCancel}"/>
              </apex:pageBlockButtons>
              
               <apex:outputPanel id="panel">
               <apex:outputText style="font-style:italic" value="Manifest lines available to remove: {0}">
                          <apex:param value="{!workOrderCount2Remove}"/>
                      </apex:outputText>
                </apex:outputPanel>
              
              <!-- In our table we are displaying the records -->
              <apex:pageBlockTable value="{!serviceOrderLines2Remove}" var="c" id="table">
                  <apex:column ><apex:facet name="header">
                      <!-- This is our selected Boolean property in our wrapper class -->
                      <apex:inputCheckbox value="{!c.selected}" onclick="checkAll(this,'checkedone')" />
                         </apex:facet>
                        <apex:inputCheckbox value="{!c.selected}" id="checkedone"/></apex:column>
                 
                 <apex:column headerValue="Work Order Line">
                      <apex:outputLink value="/{!c.con.id}">{!c.con.Name}</apex:outputLink>
                  </apex:column>
                  <apex:column headerValue="Activity Type" value="{!c.con.SVMXC__Activity_Type__c}" />
                  <apex:column headerValue="Line Type" value="{!c.con.SVMXC__Line_Type__c}" />
                  <apex:column headerValue="Line Status" value="{!c.con.SVMXC__Line_Status__c}" />
                  <apex:column headerValue="Received City" value="{!c.con.SVMXC__Received_City__c}" />
                  <apex:column headerValue="Quantity Shipped" value="{!c.con.SVMXC__Quantity_Shipped2__c}" />
                  <apex:column headerValue="Work Order" value="{!c.con.SVMXC__Service_Order__c}" />
                  <apex:column headerValue="Work Description" value="{!c.con.SVMXC__Work_Description__c}" />
              </apex:pageBlockTable>
          </apex:pageBlock>
     </apex:form>
</apex:page>

 

 

 

 

  • April 12, 2013
  • Like
  • 0

I have a VF page, my page block table is rerendering fine(table), however my Output Panel(panelWrapper) is not rerendering unless I do a full page refresh. I have tried wrapping the output panel at the pageblock level as well, and it still won't re-render properly. Any ideas would be appreciated. 

 

Thanks

 

<apex:page controller="ManifestMaintenanceController2">

<script type="text/javascript">
    function checkAll(cb,cbid)
        {
            var inputElem = document.getElementsByTagName("input");                    
            for(var i=0; i<inputElem.length; i++)
            {            
                 if(inputElem[i].id.indexOf(cbid)!=-1){                                       
                    inputElem[i].checked = cb.checked;
                }
            }
        }  
</script>

      <apex:form id="form">
            
   
          <apex:pageBlock id="block">
          
              <apex:pageBlockButtons >
                  <apex:commandButton value="Remove from Manifest" action="{!processRemoveSelected}" rerender="panelWrapper, table"/>
                   <apex:commandButton value="Return to Manifest" action="{!pageCancel}"/>
              </apex:pageBlockButtons>
                 
                  
                 <apex:outputPanel id="panelWrapper">
                 <apex:outputText style="font-style:italic" value="{0} Manifest Lines available to remove.">
                          <apex:param value="{!workOrderCount2Remove}"/>
                      </apex:outputText>
                </apex:outputPanel>
     
              <!-- In our table we are displaying the cServiceOrderLine records -->
              <apex:pageBlockTable value="{!serviceOrderLines2Remove}" var="c" id="table">
                  
                    <apex:column ><apex:facet name="header">
                      <!-- This is our selected Boolean property in our wrapper class -->
                      <apex:inputCheckbox value="{!c.selected}" onclick="checkAll(this,'checkedone')" />
                         </apex:facet>
                         
                        <apex:inputCheckbox value="{!c.selected}" id="checkedone"/></apex:column>
                 
                 
                  <!-- This is how we access the records within container/wrapper -->
                  <apex:column value="{!c.con.Name}" />
                  <apex:column value="{!c.con.SVMXC__Activity_Type__c}" />
                  <apex:column value="{!c.con.SVMXC__Line_Type__c}" />
                  <apex:column value="{!c.con.SVMXC__Line_Status__c}" />
                  <apex:column value="{!c.con.SVMXC__Received_City__c}" />
                  <apex:column value="{!c.con.SVMXC__Quantity_Shipped2__c}" />
                  <apex:column value="{!c.con.SVMXC__Service_Order__c}" />
                  <apex:column value="{!c.con.SVMXC__Work_Description__c}" />
              </apex:pageBlockTable>
        
          </apex:pageBlock>
                         
     </apex:form>
</apex:page>

  • April 09, 2013
  • Like
  • 0

I am trying to return the disctinct number of months in the last 24 months that we have an invoice line item record. The below query returns me the disctinct number of InvoiceDate values, but I just need the disctinct months(not individul dates). So my count should never be over 24. Any suggestions?

 

AggregateResult[] activePeriodCount = [SELECT account__c aid, COUNT_DISTINCT(InvoiceDate__c) ap FROM InvoiceLineItem__c where Account__c IN :setAccountId AND InvoiceDate__c != NULL AND Revenue != NULL
                                        AND Revenue!= 0 AND InvoiceDate__c =  LAST_N_YEARS:2  GROUP BY Account__c];

 

Another option is to do 24 queries with the invdividual months applied to the query, but I am trying to avoid that.

 

Thanks
       

  • March 06, 2013
  • Like
  • 0

Dear Gurus,

 

I have a batch class which works properly for the most part. One small issue is that I am getting System.LimitException: Too many query rows: 50001

Per the docs this should not happen because I am querying everything into a list and processing off the list. Can someone explain a work around or whats wrong with the code. The error occurs on the query line.

 

Any help is appreciated

 

/*This class rolls up invoices for all accounts and calculates a monthly average based on the invoice amounts/months and years queried.

 

 

global class UpdateInvoiceForecastAverages implements Database.Batchable<sObject> {
    
    //private final string strQuery;    
    global final string strQuery;  
    
    global UpdateInvoiceForecastAverages(String query)  {  
        this.strQuery = query;
        }
       
    //Execute the query.
    global database.querylocator start(Database.BatchableContext BC) {
        return Database.getQueryLocator(strQuery);
    }


    global void execute(Database.BatchableContext BC, List<sObject> scope){
        
        //get custom setting params
        Account_Forecast_Date_Parameter_Config__c paramConfig = Account_Forecast_Date_Parameter_Config__c.getValues('UpdateInvoiceForecastAverages');
        Integer startYear = Integer.valueOf(paramConfig.Start_Year__c);
        Integer endYear = Integer.valueOf(paramConfig.End_Year__c);
        Integer yearDiff;
        
        //calculate year range from custom setting params
        if (endYear == startYear) {
            yearDiff = 1;
        }
         else {
        yearDiff = (endyear - startyear) + 1;
         }
        
            //Maps to store Account Id and Related Invoices
        Map<Id, List<ESDInvoice__c>> mapInvoiceByAccount = new Map<Id, List<ESDInvoice__c>>();
        List<Account> lstAccountToUpdate = new List<Account>();
        set<Id> setAccountId = new set<Id>();
        
        //Collect Account Id's
        for(sObject sobjAccount : scope){
            Account objAccount = (Account)sobjAccount;
            setAccountId.add(objAccount.Id);    
        }
        
        //Retrieve Invoices
            
        
         for (List<ESDInvoice__c> lstInvoices : [SELECT Account__c, PostPeriod__c, InvoiceTotal2__c From ESDInvoice__c e  WHERE Account__c IN :setAccountId
                                        AND PostPeriod__c != NULL AND InvoiceTotal2__c != NULL
                                        AND InvoiceTotal2__c != 0 AND CALENDAR_YEAR(PostPeriod__c) >= :startYear AND                                                     CALENDAR_YEAR(PostPeriod__c) <= :endYear]){
                                        
            for(ESDInvoice__c objInvoice : lstInvoices){    
                if(NULL != objInvoice.Account__c){
                
                                            
                //if(NULL != objInvoice.Account__c){
                    if(!mapInvoiceByAccount.containsKey(objInvoice.Account__c))
                        mapInvoiceByAccount.put(objInvoice.Account__c, new List<ESDInvoice__c>());
                        mapInvoiceByAccount.get(objInvoice.Account__c).add(objInvoice);
                    }
                }
            }
            
        if(mapInvoiceByAccount.size() > 0){
            //Iterate through map and collect each months total
            for(Id idKey : mapInvoiceByAccount.keySet()){
                //Initialize variables
                Decimal dJanTotal = 0; Integer iJanRecordCount = 0;
                Decimal dFebTotal = 0; Integer iFebRecordCount = 0;
                Decimal dMarTotal = 0; Integer iMarRecordCount = 0;
                Decimal dAprTotal = 0; Integer iAprRecordCount = 0;
                Decimal dMayTotal = 0; Integer iMayRecordCount = 0;
                Decimal dJunTotal = 0; Integer iJunRecordCount = 0;
                Decimal dJulTotal = 0; Integer iJulRecordCount = 0;
                Decimal dAugTotal = 0; Integer iAugRecordCount = 0;
                Decimal dSeptTotal = 0;Integer iSeptRecordCount = 0;
                Decimal dOctTotal = 0; Integer iOctRecordCount = 0;
                Decimal dNovTotal = 0; Integer iNovRecordCount = 0;
                Decimal dDecTotal = 0; Integer iDecRecordCount = 0;
                
                List<ESDInvoice__c> lstInvoices = mapInvoiceByAccount.get(idKey);
                if(lstInvoices.size() > 0){
                    for(ESDInvoice__c objInvoice : lstInvoices){
                        //If Jan
                        if(objInvoice.PostPeriod__c.month() == 1){
                            dJanTotal = dJanTotal + objInvoice.InvoiceTotal2__c;
                            iJanRecordCount++;
                        }
                        
                        //If Feb
                        if(objInvoice.PostPeriod__c.month() == 2){
                            dFebTotal = dFebTotal + objInvoice.InvoiceTotal2__c;
                            iFebRecordCount++;
                        }
                        
                        //If Mar
                        if(objInvoice.PostPeriod__c.month() == 3){
                            dMarTotal = dMarTotal + objInvoice.InvoiceTotal2__c;
                            iMarRecordCount++;
                        }
                        
                        //If Apr
                        if(objInvoice.PostPeriod__c.month() == 4){
                            dAprTotal = dAprTotal + objInvoice.InvoiceTotal2__c;
                            iAprRecordCount++;
                        }
                        
                        //If May
                        if(objInvoice.PostPeriod__c.month() == 5){
                            dMayTotal = dMayTotal + objInvoice.InvoiceTotal2__c;
                            iMayRecordCount++;
                        }
                        
                        //If June
                        if(objInvoice.PostPeriod__c.month() == 6){
                            dJunTotal = dJunTotal + objInvoice.InvoiceTotal2__c;
                            iJunRecordCount++;
                        }
                        
                        //If July
                        if(objInvoice.PostPeriod__c.month() == 7){
                            dJulTotal = dJulTotal + objInvoice.InvoiceTotal2__c;
                            iJulRecordCount++;
                        }
                        
                        //If Aug
                        if(objInvoice.PostPeriod__c.month() == 8){
                            dAugTotal = dAugTotal + objInvoice.InvoiceTotal2__c;
                            iAugRecordCount++;
                        }
                        
                        //If Sept
                        if(objInvoice.PostPeriod__c.month() == 9){
                            dSeptTotal = dSeptTotal + objInvoice.InvoiceTotal2__c;
                            iSeptRecordCount++;
                        }
                        
                        //If Oct
                        if(objInvoice.PostPeriod__c.month() == 10){
                            dOctTotal = dOctTotal + objInvoice.InvoiceTotal2__c;
                            iOctRecordCount++;
                        }
                        
                        //If Nov
                        if(objInvoice.PostPeriod__c.month() == 11){
                            dNovTotal = dNovTotal + objInvoice.InvoiceTotal2__c;
                            iNovRecordCount++;
                        }
                        
                        //If Dec
                        if(objInvoice.PostPeriod__c.month() == 12){
                            dDecTotal = dDecTotal + objInvoice.InvoiceTotal2__c;
                            iDecRecordCount++;
                        }
                    }    
                }
        
        /* For testing yeardiff for multiple year calc */
        
                Decimal dFinalJanAvg = iJanRecordCount == 0 ? 0 : dJanTotal/yearDiff;
                Decimal dFinalFebAvg = iFebRecordCount == 0 ? 0 : dFebTotal/yearDiff;
                Decimal dFinalMarAvg = iMarRecordCount == 0 ? 0 : dMarTotal/yearDiff;
                Decimal dFinalAprAvg = iAprRecordCount == 0 ? 0 : dAprTotal/yearDiff;
                Decimal dFinalMayAvg = iMayRecordCount == 0 ? 0 : dMayTotal/yearDiff;
                Decimal dFinalJunAvg = iJunRecordCount == 0 ? 0 : dJunTotal/yearDiff;
                Decimal dFinalJulAvg = iJulRecordCount == 0 ? 0 : dJulTotal/yearDiff;
                Decimal dFinalAugAvg = iAugRecordCount == 0 ? 0 : dAugTotal/yearDiff;
                Decimal dFinalSeptAvg = iSeptRecordCount == 0 ? 0 : dSeptTotal/yearDiff;
                Decimal dFinalOctAvg = iOctRecordCount == 0 ? 0 : dOctTotal/yearDiff;
                Decimal dFinalNovAvg = iNovRecordCount == 0 ? 0 : dNovTotal/yearDiff;
                Decimal dFinalDecAvg = iDecRecordCount == 0 ? 0 : dDecTotal/yearDiff;
        
        
                lstAccountToUpdate.add(new Account(Id = idKey, Invoice_Line_Item_Avg_Jan__c = dFinalJanAvg, Invoice_Line_Item_Avg_Feb__c = dFinalFebAvg, Invoice_Line_Item_Avg_Mar__c = dFinalMarAvg, Invoice_Line_Item_Avg_Apr__c = dFinalAprAvg, Invoice_Line_Item_Avg_May__c = dFinalMayAvg, Invoice_Line_Item_Avg_Jun__c = dFinalJunAvg, Invoice_Line_Item_Avg_Jul__c = dFinalJulAvg, Invoice_Line_Item_Avg_Aug__c = dFinalAugAvg,  Invoice_Line_Item_Avg_Sept__c = dFinalSeptAvg, Invoice_Line_Item_Avg_Oct__c = dFinalOctAvg, Invoice_Line_Item_Avg_Nov__c = dFinalNovAvg, Invoice_Line_Item_Avg_Dec__c = dFinalDecAvg));
            }
        }
        
        try{
        if(lstAccountToUpdate.size() > 0)
            update lstAccountToUpdate;
        }
        catch(exception ex){
            system.debug('Exception Message :: ' + ex.getMessage());
        }
    }    
    
    global void finish(Database.BatchableContext BC)  {  
system.debug('Batch Complete');
    
        
    }
}

  • December 03, 2012
  • Like
  • 0

I am testing out web2lead in a sandbox environment. Everything appears to work except a minor issues and was wondering if this was due to perhaps being a sandbox and not production. Anyone experiened this before?

 

Issue -

 

retURL seems to be ignored. Although a lead is created immediatley, I get the following message everytime when submitting the webform with lead info.

 

Your request has been queued.

Record Information:

00N30000007g2JK: Test Additional Info
00Ne0000000K5xJ: Company Reputation
00Ne0000000K5xJ: Referral
00Ne0000000K5xJ: Price
00Ne0000000K5xJ: Safety
00Ne0000000K5xJ: Service
00Ne0000000K7Lb: Test Other Text
__EVENTARGUMENT:
__EVENTTARGET:
__EVENTVALIDATION: /wEWBAKDoenRBQLX2PrXDgLI1NazDgK/xI7IBw70Ui4OHXpuwGDVHV53D5nKylITABIJQq6LpjhIBeOX
__VIEWSTATE: /wEPDwUKMTY4NTc0NzEzOQ9kFgJmD2QWAgIDD2QWBAIJD2QWAgIBD2QWAmYPZBYCZg9kFgQCAQ8PZBYCHgVzdHlsZQUNZGlzcGxheTpub25lO2QCAw8UKwACFCsAAg8WAh4LXyFEYXRhQm91bmRnZA8UKwADFCsAAg8WDB4EVGV4dAUIUFNDIEhvbWUeC05hdmlnYXRlVXJsBQ5+L2RlZmF1bHQuYXNweB4FVmFsdWUFCFBTQyBIb21lHgdUb29sVGlwBakBTmF0aW9ud2lkZSBMZWFkZXIgaW4gSW5kdXN0cmlhbCBDbGVhbmluZywgRW52aXJvbm1lbnRhbCBNYW5hZ2VtZW50LCBUcmFuc3BvcnQgJmFtcDsgRGlzcG9zYWwsIEVtZXJnZW5jeSBSZXNwb25zZSwgUmVtZWRpYXRpb24sIEJvaWxlciBPdXRhZ2UsIFZhY3V1bSwgYW5kIFJldGFpbCBTZXJ2aWNlLh4IQ3NzQ2xhc3MFFnNmQnJlYWRjcnVtYk5hdmlnYXRpb24eBF8hU0ICAmRkFCsAAg8WDB8CBQlBYm91dCBQU0MfAwUOfi9BYm91dFVzLmFzcHgfBAUJQWJvdXQgUFNDHwVlHwYFFnNmQnJlYWRjcnVtYk5hdmlnYXRpb24fBwICZGQUKwACDxYMHwIFEkNvbnRhY3QgUFNDIC0gVEVTVB8DBRNqYXZhc2NyaXB0OiB2b2lkKDApHwQFEkNvbnRhY3QgUFNDIC0gVEVTVB8FBacBQnkgZmlsbGluZyBvdXQgdGhlIGZvcm0gYmVsb3csIG9uZSBvZiBvdXIgZW52aXJvbm1lbnRhbCBvciBpbmR1c3RyaWFsIHNlcnZpY2VzIGV4cGVydHMgd2lsbCBiZSBpbiB0b3VjaCB3aXRoIHlvdSB0byBhbnN3ZXIgYW55IHF1ZXN0aW9ucyBvciBjb25jZXJucyB0aGF0IHlvdSBtYXkgaGF2ZS4fBgUYc2ZOb0JyZWFkY3J1bWJOYXZpZ2F0aW9uHwcCAmRkDxQrAQNmZmYWAQV2VGVsZXJpay5XZWIuVUkuUmFkU2l0ZU1hcE5vZGUsIFRlbGVyaWsuV2ViLlVJLCBWZXJzaW9uPTIwMTIuMi42MDcuNDAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49MTIxZmFlNzgxNjViYTNkNGQWBmYPDxYMHwIFCFBTQyBIb21lHwMFDn4vZGVmYXVsdC5hc3B4HwQFCFBTQyBIb21lHwUFqQFOYXRpb253aWRlIExlYWRlciBpbiBJbmR1c3RyaWFsIENsZWFuaW5nLCBFbnZpcm9ubWVudGFsIE1hbmFnZW1lbnQsIFRyYW5zcG9ydCAmYW1wOyBEaXNwb3NhbCwgRW1lcmdlbmN5IFJlc3BvbnNlLCBSZW1lZGlhdGlvbiwgQm9pbGVyIE91dGFnZSwgVmFjdXVtLCBhbmQgUmV0YWlsIFNlcnZpY2UuHwYFFnNmQnJlYWRjcnVtYk5hdmlnYXRpb24fBwICZGQCAQ8PFgwfAgUJQWJvdXQgUFNDHwMFDn4vQWJvdXRVcy5hc3B4HwQFCUFib3V0IFBTQx8FZR8GBRZzZkJyZWFkY3J1bWJOYXZpZ2F0aW9uHwcCAmRkAgIPDxYMHwIFEkNvbnRhY3QgUFNDIC0gVEVTVB8DBRNqYXZhc2NyaXB0OiB2b2lkKDApHwQFEkNvbnRhY3QgUFNDIC0gVEVTVB8FBacBQnkgZmlsbGluZyBvdXQgdGhlIGZvcm0gYmVsb3csIG9uZSBvZiBvdXIgZW52aXJvbm1lbnRhbCBvciBpbmR1c3RyaWFsIHNlcnZpY2VzIGV4cGVydHMgd2lsbCBiZSBpbiB0b3VjaCB3aXRoIHlvdSB0byBhbnN3ZXIgYW55IHF1ZXN0aW9ucyBvciBjb25jZXJucyB0aGF0IHlvdSBtYXkgaGF2ZS4fBgUYc2ZOb0JyZWFkY3J1bWJOYXZpZ2F0aW9uHwcCAmRkAgsPZBYCAgIPZBYCAgEPDxYCHwIF2QM8cD5JbiBvcmRlciBmb3IgUFNDIHRvIHNlcnZlIHlvdSBiZXR0ZXIsIHBsZWFzZSBjb21wbGV0ZSB0aGUgZm9sbG93aW5nIGFuZCB3ZSB3aWxsIGhhdmUgYSByZXByZXNlbnRhdGl2ZSBjb250YWN0IHlvdS4gUmVxdWlyZWQgZmllbGRzIGFyZSBtYXJrZWQgd2l0aCBhIHJlZCAoPHNwYW4gY2xhc3M9ImNwc2NyZXF1aXJlZCI+Kjwvc3Bhbj4pLjwvcD48YnIgLz48cD4oRm9yIDxiPkVtcGxveW1lbnQgT3Bwb3J0dW5pdGllczwvYj4sIHBsZWFzZSBzZWFyY2ggb3VyIHVwZGF0ZWQgPGEgc3R5bGU9J2NvbG9yOiM1NGJjZWI7IHRleHQtZGVjb3JhdGlvbjp1bmRlcmxpbmU7IGZvbnQtd2VpZ2h0OmJvbGQ7JyBocmVmPSdlbXBsb3ltZW50X29wcG9ydHVuaXRpZXMuYXNweCc+Sm9iIFBvc3RpbmdzPC9hPi4gRW1wbG95bWVudCByZXF1ZXN0cyBzdWJtaXR0ZWQgdGhyb3VnaCB0aGlzIGZvcm0gd2lsbCBub3QgYmUgY29uc2lkZXJlZC4pPC9wPmRkGAEFHl9fQ29udHJvbHNSZXF1aXJlUG9zdEJhY2tLZXlfXxYBBUhjdGwwMCRDb250ZW50UGxhY2VIb2xkZXJfQnJlYWRjcnVtYnMkVDNERkQwNDZEMDAyJGN0bDAwJGN0bDAwJEJyZWFkY3J1bWLMxlAIdS9rhPqRadbiquUJffpEl61TRhSy3TEYKdKoCQ==
city: Houston
company: Test Company 5
ctl00$ContentPlaceHolder_MainPara1$C001$submit: submit
ctl00$ContentPlaceHolder_Search$T3DFD046D001$ctl00$ctl00$searchTextBox:
ctl00$ctl08:
ctl00_ContentPlaceHolder_Breadcrumbs_T3DFD046D002_ctl00_ctl00_Breadcrumb_ClientState:
ctl08_TSM: ;;System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35:en-US:89093640-ae6b-44c3-b8ea-010c934f8924:ea597d4b:b25378d2;;Telerik.Sitefinity.Resources:en-US:e42dd702-8f76-4861-a58f-bd9f5273c6d3:7ee0bb1f:83eb063b;;Telerik.Sitefinity:en-US:ae08fefb-9765-44e6-ab0a-ab20e67c7aef:993d8e92:5b182b17:3b9a1b05;Telerik.Sitefinity.Search.Impl, Version=5.1.3450.0, Culture=neutral, PublicKeyToken=b28c218413bdf563:en-US:0193a47b-ec0b-4c30-ad4e-881b5cb15817:7561727d;Telerik.Web.UI, Version=2012.2.607.40, Culture=neutral, PublicKeyToken=121fae78165ba3d4:en-US:767fb6c3-728b-40e9-af4d-abc498bcae6e:a1a4383a
ctl09_TSSM: ;Telerik.Sitefinity.Resources, Version=5.1.3450.0, Culture=neutral, PublicKeyToken=null:en:e42dd702-8f76-4861-a58f-bd9f5273c6d3:d271177c:dff30785;Telerik.Web.UI, Version=2012.2.607.40, Culture=neutral, PublicKeyToken=121fae78165ba3d4:en:767fb6c3-728b-40e9-af4d-abc498bcae6e:580b2269;Telerik.Web.UI.Skins, Version=2012.2.607.40, Culture=neutral, PublicKeyToken=121fae78165ba3d4:en:4b54c6d7-e7a5-482b-9e15-94b493c9591a:6c8ef648
debug: 1
debugEmail: falfadli@gmail.com
email: falfadli@gmail.com
encoding: UTF-8
first_name: Test 8
last_name: Test 5L
oid: 00De00000008eag
phone: 832 3333333
retURL: http://www.yahoo.com

state: TX
street: 1111 Main Street
title: Test Title
zip: 77024

  • November 21, 2012
  • Like
  • 0

Hi all, I am trying to use the agregate function in the following method. I am attempting to get the average value of invoie totals per the query below. But it appears to only reflect one record from the query. For example, if my invoice amounts are $5, $10 and $12. I am getting returned one of the values, but not the average. Can someone tell me what I am doing wrong.

 

Thanks

 

    global void execute(Database.BatchableContext BC, List<sObject> scope){
        
        Map<Id, Decimal> janavg = new Map<Id, Decimal>();
        
        
        List<Account> accts2updateJan = new List<Account>();
        
        
        for(sObject s : scope)
            {Account a = (Account)s;
            janavg.put(a.Id,0);
            
        }
 
            
        AggregateResult[] jangr = [SELECT Account__c aid, PostPeriod__c, AVG(InvoiceTotal2__c) AvgInvoice From ESDInvoice__c e  WHERE Account__c IN :janavg.keyset() AND CALENDAR_MONTH(PostPeriod__c) = 1 GROUP BY Account__c, PostPeriod__c];
        
        //get jan
        for (AggregateResult ar : jangr)  {
        
            if (janavg.containsKey((Id)ar.get('aid'))) {
                janavg.put((Id)ar.get('aid'), (Decimal)ar.get('AvgInvoice'));
                System.debug('Status -- Jan Average From query = ' + (Decimal)ar.get('AvgInvoice'));
            }
        }

 

 

  • November 08, 2012
  • Like
  • 0

Dear Gurus,

 

I have implemented SAML SSO with Active Directory Federated Services. Everything works ok except for one item.

 

We have a lot of workflows that send emails with links to records in SFDC. If a user clicks on the link without first being authenticated they get the following error "405 - HTTP verb used to access this page is not allowed"

 

If they login to SFDC first, they do not get this error.

 

Any ideas?

 

Thanks

  • September 11, 2012
  • Like
  • 0

Dear Gurus,

 

We currently have delegated SSO implemented, I want to enable SAML based SSO and run some tests prior to enabling for all of our users. I have sucessfully tested in a sandbox, but want to be careful in production so I dont effect all the users. SFDC admin settings appear to let me have both ebnabled at the same time. Does anyone know if this will cause any issues or am I ok with most users being Delegated and a handful of testers being federated.

 

Thanks

 

 

  • August 10, 2012
  • Like
  • 0

Dear Guru's,

 

can someone reccomend a tool to monitor Apex and Trigger changes to production or sandbox orgs. Looking to monitor our instances to track changes for governance reasons.

 

Thanks

  • October 06, 2011
  • Like
  • 0

We are constantly on the lookout for Salesforce consultants, architects, developers and administrators. Send all resumes to jobs@cloudras.com for immediate consideration.

  • September 23, 2011
  • Like
  • 0

I have a report I have buit for my clients users. I want to be able to dynamically pass the account to the report via a custom button(ie, I only want to see records in the report for the existing account). I do not see a way to do this off hand. I don't want to use the filters in the report builder as that would be a static value.

 

So the use case is the sales user will be in the account module. Based on a custom button on the accounts page or related list of accounts, I can dynamically associate a launced report with the account from which the request was made.

 

 

Any help or approaches would be appreciated.

 

Dodi

  • June 09, 2011
  • Like
  • 0

Is there a setting where I can disable the log files for a batch data loader process. I am loading high volumes and don't want to manage the log files and the log directory grows very rapidly. Any parameters in the log4J config file  to just disable them entirley.

 

Thanks

  • June 06, 2011
  • Like
  • 0

Dear Guru's

 

I have configured some batch processes to load data into SFDC using the dataloader from the command line.....all works well....however, my source file has comma's in the data. Since the data loader reads from a CSV file, how can I configure it to know that the comma is actually part of a data attribute and not the delimiter.

 

Is there a special character I can write to the source file so that a comma is considered part of the record?

 

Thanks

 

 

  • June 02, 2011
  • Like
  • 0

 I am having a small issue with a controller I am trying to build. I was hoping I can run the issue by the board to see if anyone had any insight to the issue.

I have a VisualForce page that loads some records into a sortable table. The sort functionality s provided by a class called superSort(from a SFDC example posting located at http://wiki.developerforce.com/index.php/Sorting_Tables). I am able to successfully use it for the first time the page loads without a problem. Also on the page I have some fields that the user can set to pass parameters to the same query. I am running into issues with calling the supersort class a second time from my controller via a command button. There is an issue with my list and I am getting "Index out of bounds" errors when calling the super sort method. So the method works fine for my first list when the page is loded, just not the second one when I send in another request with the new parameters for the query and want the page refresed. I get the errors when I try to set the initial List to null.

Pasting my controller and VF code below.


Thanks

Dodi

Controller :

public class SalesAndForecastSort {

    public List<Sales_Forecasts__c> sf;
    public String sortField {get; set;}
    public String previousSortField {get; set;}
    public String sfRecordType {get; set;}
    public Id sfAccount {get; set;}
    public Id rt {get; set;}
    public Id rtInvoicesSales {get; set;}
    public Id rtOpenOrders {get; set;}
    public Id rtEvergreen {get; set;}
    public Id Salesforecast {get; set;}
    public String selectedRecordType {get; set;}
    public String selectedAccountingMonth {get; set;}
   
    public String accountingMonth {get; set;}
   
    
    public String getSelectedAccountingMonth() {
                return selectedAccountingMonth;
       }
   
    
    public String getSelectedRecordType() {
                return selectedRecordType;
        }
   /*
    public void setSelectedRecordType(Id selectedRecordType) {
                this.selectedRecordType = selectedRecordType;
        }
  


    public void setSelectedAccountingMonth(String selectedAccountingMonth) {
                this.selectedAccountingMonth = selectedAccountingMonth;
        }
       */
 
      
    public List<SelectOption> getRtOptions() {
            List<SelectOption> rtOptions = new List<SelectOption>();
           
            rtOptions.add(new SelectOption('NA','--'));
            rtOptions.add(new SelectOption('Invoiced','Invoiced'));
            rtOptions.add(new SelectOption('Open','Open'));
            rtOptions.add(new SelectOption('Evergreen','Evergreen'));
            rtOptions.add(new SelectOption('Salesforecast','Salesforecast'));
            return rtOptions;
           
        }
       
        public List<SelectOption> getAccountingMonths() {
            List<SelectOption> accountingMonths = new List<SelectOption>();
           
            accountingMonths.add(new SelectOption('NA','--'));
            accountingMonths.add(new SelectOption('January','January'));
            accountingMonths.add(new SelectOption('February','February'));
            accountingMonths.add(new SelectOption('March','March'));
            accountingMonths.add(new SelectOption('April','April'));
            accountingMonths.add(new SelectOption('May','May'));
            accountingMonths.add(new SelectOption('June','June'));
            accountingMonths.add(new SelectOption('July','July'));
            accountingMonths.add(new SelectOption('August','August'));
            accountingMonths.add(new SelectOption('September','September'));
            accountingMonths.add(new SelectOption('October','October'));
            accountingMonths.add(new SelectOption('November','November'));
            accountingMonths.add(new SelectOption('December','December'));
            return accountingMonths;
           
        }
       
        public List<Sales_Forecasts__c> getSF() {
       
         //get params from URL string      
         sfRecordType = ApexPages.currentPage().getParameters().get('sfRecordType');
         sfAccount = ApexPages.currentPage().getParameters().get('sfAccount');
         //Set up maps to hold the Record Type IDs and the literal values associated            
         Map<String, Id> sfRecordTypeMap = new Map <String,Id>();  
         //insert record ids into map
         for (RecordType asfRecordType : [SELECT Id, Name FROM RecordType WHERE IsActive = TRUE AND SobjectType = 'Sales_Forecasts__c' LIMIT 1000] ) {
                 sfRecordTypeMap.put(asfRecordType.Name, asfRecordType.Id);      
             }  
                                              
         //associate record type values to appropriate record types to be used in query
       
        if (sfRecordType.equals('Invoiced')) {
                rt = sfRecordTypeMap.get('Invoiced Sales');    
        }    
       
        if (sfRecordType.equals('Open')) {
                rt = sfRecordTypeMap.get('Open Orders');       
        }
       
        if (sfRecordType.equals('Evergreen')) {
                rtInvoicesSales = sfRecordTypeMap.get('Evergreen');    
        }
               
        if (sfRecordType.equals('SalesForecast')) {
                rtInvoicesSales = sfRecordTypeMap.get('Sales Forecast');       
        }
       
                if(sf == null){
                    sf = [Select Product2__c, Net_Proceeds_USD__c, Net_Proceeds_LC__c, Net_Proceeds_FC__c, Account__c From Sales_Forecasts__c Where Account__c = :sfAccount AND RecordTypeId = :rt];
                }
                return sf;
              
    }
 
 
//public List<Sales_Forecasts__c> getUserDefinedSF(String accountingMonth, String sfRecordType) {
       
       
         public List<Sales_Forecasts__c> getUserDefinedSF(String sfRecordType) {
       
       
            
              //sf.clear();
       
         //Set up maps to hold the Record Type IDs and the literal values associated            
         Map<String, Id> sfRecordTypeMap = new Map <String,Id>();  
         //insert record ids into map
         for (RecordType asfRecordType : [SELECT Id, Name FROM RecordType WHERE IsActive = TRUE AND SobjectType = 'Sales_Forecasts__c' LIMIT 1000] ) {
                 sfRecordTypeMap.put(asfRecordType.Name, asfRecordType.Id);      
             }  
                                              
         //associate record type values to appropriate record types to be used in query
       
        if (sfRecordType.equals('Invoiced')) {
                rt = sfRecordTypeMap.get('Invoiced Sales');    
        }    
       
        if (sfRecordType.equals('Open')) {
                rt = sfRecordTypeMap.get('Open Orders');       
        }
       
        if (sfRecordType.equals('Evergreen')) {
                rtInvoicesSales = sfRecordTypeMap.get('Evergreen');    
        }
               
        if (sfRecordType.equals('SalesForecast')) {
                rtInvoicesSales = sfRecordTypeMap.get('Sales Forecast');       
        }
                ///issue is here, value has to be null...but when clearing the list...out of bound exceptions occur
                if(sf == null){
               
                //sf = [Select Product2__c, Net_Proceeds_USD__c, Net_Proceeds_LC__c, Net_Proceeds_FC__c, Account__c From Sales_Forecasts__c Where Account__c = :sfAccount AND RecordTypeId = :rt];
                //sf = [Select Product2__c, Net_Proceeds_USD__c, Net_Proceeds_LC__c, Net_Proceeds_FC__c, Account__c From Sales_Forecasts__c Where RecordTypeId = :rt];
                sf = [Select Product2__c, Net_Proceeds_USD__c, Net_Proceeds_LC__c, Net_Proceeds_FC__c, Account__c From Sales_Forecasts__c];
                }
               
                else {
                    
                    Account a = new Account(Name='VisualForce2', End_Use__c='Nexar', Ship_Account_Region__c='JAPAN');
                    Insert a;
              
                }
                return sf;
              
    }
 
 
public PageReference page_search() {
       
         //get user selected record type
         sfRecordType = selectedRecordType;
        
         //get user selected accounting Month
         accountingMonth = selectedAccountingMonth;
        
         //getUserDefinedSF(accountingMonth, sfRecordType);
          getUserDefinedSF(sfRecordType);
        
         //getSF();
         sortField = 'Product2__c';
       
         doSort();
     
         return null;
     }
     
public void doSort(){
        String order = 'asc';
       
        //This checks to see if the same header was click two times in a row, if so it switches the order.
       
        if(previousSortField == sortField){
            order = 'desc';
            previousSortField = null;
        }else{
            previousSortField = sortField;
        }
      
        //To sort the table we simply need to use this one line, nice!
        superSort.sortList(sf,sortField,order);
    }
}


VP Page in next posting

  • May 03, 2011
  • Like
  • 0

Is there an equivalent of the standard DISTINCT statement for SOQL (SELECT DISTINCT email from Some_Table) like ther eis in standard SQL? There is a DISTINCT COUNT(field).....but I am looking for just DISTINCT so that duplicate values are not returned?

 

Thanks

  • April 28, 2011
  • Like
  • 0

Dear Gurus,

 

I am having some trouble with the following class. I am trying to update individual account records with the Net_Proceeds_USD__c, Net_Proceeds_LC__c, Net_Proceeds_FC__c values. Everything works fine up to the point where I am actually updating the account. Currently this compiles fine, but during runtime it updates all the accounts with the same value. So it does not appear that I am updating from my list correctly. Below is the code, I have also put comments where the problem is occuring. Any advise is appreciated!

 

 

global class RollUpNetProceeds {
          
                 webService static void setNetProceeds(){
                    Integer salesForecastCount;            
                    Integer accountCount;            
                    
                    //get number of accounts
                    accountCount = [Select count() FROM Account];
                     //get Sales and Forecast record count            
                    salesForecastCount = [Select count() FROM Sales_Forecasts__c];
                    System.debug('Account record count is ' + accountCount);
                    System.debug('Sales and Forecast record count is ' + salesForecastCount);
                    ///put all accounts in a list
                    List<Account> accountList = new List<Account>();  
                    accountList = [Select a.Id, a.Name, a.Net_Proceeds_USD__c, a.Net_Proceeds_LC__c, a.Net_Proceeds_FC__c From Account a];
                    Integer accountListSize = accountList.size();
                    Integer salesForecastListSize;
                    System.debug('Account List size is ' + accountListSize);
                    
                    List<Sales_Forecasts__c> aSalesForecastList = new List<Sales_Forecasts__c>();
                
                    ///iterate through list of accounts
                    for (Integer a = 0; a < accountListSize; a++) {
                        //System.debug('Account Id is ' + accountList.get(a).Id);
                        //put individual Sales and Forecast records into a list
                        
                        aSalesForecastList = [Select Net_Proceeds_FC__c , Net_Proceeds_USD__c, Net_Proceeds_LC__c from Sales_Forecasts__c where Account__c = :accountList.get(a).Id];
                        
                        salesForecastListSize = aSalesForecastList.size();
        
                        ///set up variables for totals
                        Decimal accountTotalNetProceedsFC = 0;
                        Decimal accountTotalNetProceedsLC = 0;
                        Decimal accountTotalNetProceedsUSD = 0;
                        String tempAccountTotalNetProceedsLC;
                        
                        ///iterate through list of Sales and Forecast records and sum totals per Account
                        for (Integer b = 0; b < salesForecastListSize; b++) {
                        
                            tempAccountTotalNetProceedsLC = aSalesForecastList.get(b).Net_Proceeds_LC__c;
                            Integer i = tempAccountTotalNetProceedsLC.length();
                            String tempLC = tempAccountTotalNetProceedsLC.substring(4, i);
                            
                            accountTotalNetProceedsFC = accountTotalNetProceedsFC + aSalesForecastList.get(b).Net_Proceeds_FC__c;
                            accountTotalNetProceedsLC = accountTotalNetProceedsLC + decimal.valueOf(tempLC);
                            accountTotalNetProceedsUSD = accountTotalNetProceedsUSD + aSalesForecastList.get(b).Net_Proceeds_USD__c;
    
                            
                        }
                            System.debug(' Total FC Net Proceed Value for Account: '+ accountList.get(a).Name +  ' is ' + accountTotalNetProceedsFC);
                            System.debug(' Total LC Net Proceed Value for Account: '+ accountList.get(a).Name +  ' is ' + accountTotalNetProceedsLC);
                            System.debug(' Total USD Net Proceed Value for Account: '+ accountList.get(a).Name +  ' is ' +  accountTotalNetProceedsUSD);
                           
 ////Problem starts here, incorrect accounts are being updated. Same values will apply to all accounts                           

for(Account account: accountList) {
                                account.Net_Proceeds_USD__c = accountTotalNetProceedsUSD;
                                account.Net_Proceeds_FC__c = accountTotalNetProceedsFC;
                                account.Net_Proceeds_LC__c = accountTotalNetProceedsLC.toPlainString();
                            }
                            update accountList;
                            
            
                    } // close acct loop
                    
                
                 } // webservice
                                                     
}

  • April 25, 2011
  • Like
  • 0

Dear Gurus,

 

this is probably a no-brainer, but I am looking for help with the following:

 

I have an Apex class where I am trying to access values from a field that I have put in a List object. Then object populates as expected...However the below string format is returned using the method - uanVals.get(i). It is my understaning that the get method on the List object will return me the result in the proper index ....which it does.

 

The method  uanVals.get(i) from  a list object returns the proper records, however the formate below is giving me trouble.

 

"Utility_Account__c:{Utility_Account_Number__c=1008901001900249540108, Id=a0EQ0000001trzXMAQ}"

 

How can I get the call from the list object to only return me the string value I need. In this case '1008901001900249540108';

 

Thanks in advance

 

 

  • January 27, 2011
  • Like
  • 0
Hi all, I have a requirement where we access pdf docs from a third party web service that stores them. I am trying to bring these back into Salesforce as attachments and I have a call out that passes in the request xml and receives a response ok. Question is how do we access the binary attachment section of the response? The attachment is outside the soap envelope and trying to figure out how to get to it so I can load it as an attachment. 

<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
   <S:Body>
      <ns2:DocDNAExtractResponse xmlns:ns2="http://hq-srames-lt.lason.com/DocDNAWS/">
         <Result>
            <ResponseXML><![CDATA[<RESPONSE>
<DOCS_FOUND>3</DOCS_FOUND>
<DOCS_EXTRACTED>3</DOCS_EXTRACTED>
</RESPONSE>]]></ResponseXML>
            <StatusXML>&lt;STATUS>SUCCESS&lt;/STATUS></StatusXML>
            <Documents>
               <IndexDetails>PSC_GENID    PSC_GENNME    PSC_CUSTID    PSC_CUSNME    PSC_SDOCID    PSC_ORDNUM    PSC_GENSDT    PSC_TSDFSD    PSC_IDOCID    PSC_DOCTYP    PSC_DOCID    PSC_MANFLG    PSC_SCNDTE    Pages</IndexDetails>
               <FileAttachmentList>
                  <FileName>83115e33-015e-4d09-9bdf-bfda3a93424e-000001.pdf</FileName>
                  <Attachment>
                     <xop:Include href="cid:b5a0b95f-9f14-41b1-85af-dab89be0561b@example.jaxws.sun.com" xmlns:xop="http://www.w3.org/2004/08/xop/include"/>
                  </Attachment>
               </FileAttachmentList>
            </Documents>
         </Result>
      </ns2:DocDNAExtractResponse>
   </S:Body>
</S:Envelope>



HTTP/1.1 200 OK
Date: Wed, 10 Jun 2015 19:02:27 GMT
Transfer-Encoding: chunked
Content-Type: multipart/related;start="<rootpart*7ae4c202-67e8-4e07-8a57-0034174bd098@example.jaxws.sun.com>";type="application/xop+xml";boundary="uuid:7ae4c202-67e8-4e07-8a57-0034174bd098";start-info="text/xml"
Set-Cookie: JSESSIONID=jj7QV4JD4Z1MB2TDBrGnT49K56KK0RRvqBZYSjlXYjf3nkLWClnQ!2091688840; path=/; secure; HttpOnly
X-Powered-By: Servlet/2.5 JSP/2.1
Set-Cookie: BIGipServerDNA_Securevault_pool=3154379274.22811.0000; path=/

--uuid:7ae4c202-67e8-4e07-8a57-0034174bd098
Content-Id: <rootpart*7ae4c202-67e8-4e07-8a57-0034174bd098@example.jaxws.sun.com>
Content-Type: application/xop+xml;charset=utf-8;type="text/xml"
Content-Transfer-Encoding: binary

<?xml version='1.0' encoding='UTF-8'?><S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"><S:Body><ns2:DocDNAExtractResponse xmlns:ns2="http://hq-srames-lt.lason.com/DocDNAWS/"><Result><ResponseXML>&lt;RESPONSE>&#xd;
&lt;DOCS_FOUND>3&lt;/DOCS_FOUND>&#xd;
&lt;DOCS_EXTRACTED>3&lt;/DOCS_EXTRACTED>&#xd;
&lt;/RESPONSE>&#xd;
</ResponseXML><StatusXML>&lt;STATUS>SUCCESS&lt;/STATUS></StatusXML><Documents><IndexDetails>PSC_GENID    PSC_GENNME    PSC_CUSTID    PSC_CUSNME    PSC_SDOCID    PSC_ORDNUM    PSC_GENSDT    PSC_TSDFSD    PSC_IDOCID    PSC_DOCTYP    PSC_DOCID    PSC_MANFLG    PSC_SCNDTE    Pages&#xd;
</IndexDetails><FileAttachmentList><FileName>83115e33-015e-4d09-9bdf-bfda3a93424e-000001.pdf</FileName><Attachment><xop:Include xmlns:xop="http://www.w3.org/2004/08/xop/include" href="cid:b5a0b95f-9f14-41b1-85af-dab89be0561b@example.jaxws.sun.com"/></Attachment></FileAttachmentList></Documents></Result></ns2:DocDNAExtractResponse></S:Body></S:Envelope>
--uuid:7ae4c202-67e8-4e07-8a57-0034174bd098
Content-Id: <b5a0b95f-9f14-41b1-85af-dab89be0561b@example.jaxws.sun.com>
Content-Type: application/octet-stream
Content-Transfer-Encoding: binary

%PDF-1.4
%����
2 0 obj
<</Length 40>>stream
q 1287.75 0 0 1679.25 0 0 cm /Im1 Do Q

endstream
endobj
4 0 obj
<</DecodeParms<</K -1/Rows 2239/Columns 1717>>/Type/XObject/Subtype/Image/ColorSpace/DeviceGray/Width 1717/BitsPerComponent 1/Length 53021/Height 2239/Filter/CCITTFaxDecode>>stream
&�d� `�9 a��r1��9�ßpWr������T2����
���ʒV@� �sa�9 A�#r9�0�Ð����4�0��I�7rC�rsa�Q�9�0�s�w;�s�Pu�
/�5A��0�r1��0��sa�9';��)�9��$)!��T��3�ʃ����c��n�s�)�\��C 6�3�ra�Q�;�
s�� �rs��Ürr 㑎B�a�9�Øsg$��DDDDDDDDDDDDDDDDy@A��0�(�3�a�Q�9�;��a��;��Øs�'$9�㑎a�9�0�Ð0�2�0�sw;�s�܌r7Mb"""""""S�x����.�d|�"""""<�@���s@�r
#�H���9�0�Øsw?��6I2�9Y��� �YNq�9�0� �s�ey�0�nTyZ�����9��?9Vw;����:Φ��hȺ+�"t]��[����Dw�#�N�J��tG��Q$��]���"-�2Vf����F!&��H����q2e�< ˳_L�6͑��q�D�s8f��.F�r.k��SM4�l}s�s�*/�����e�A��O�M>�����������������b�����G��{��_�������2�&P/�=������_����J���Ȕ�8��������������/_���w�����(������������y�*���������w)?ˠؐ����_������$��TG����������i7�h~���������������������A����������-��)������������EK:唗��+��������w�F�_���_�������DE���to�z������o���WX�����������&�J��֛���_�_������!u������������%����������u�����������"@c�����������������������_������%���������� �#�}���_�������"?����������������������fW����_�������~�z���������𽮷���������q�����������H�G��u�������������������}�u���������u���������'z�����������S��_������_���������������]������r!��l/���W����׿�[I��������������u����������__�����~Y�������������|�f�>>�����{����e�F�0�_�����������nd�ß"��j�k吺�������_���a�;    ��w����
tgVH"��    ������������i�anHz�$xA��P��c���������u�!��શ���E �'��������������~5K�Ó�XN����UUS������������d-']���u&�N�P�P������u����^�O|?��-�#I=8P�8Zs�/����������D�+�&=~�����V������������oA���X_��a��_⡯�����������P����#��y��ܘ������������K��Zֹ�l���������~���;����U��Lj����������{�,�O_�/�q�����������x�9 �%����{%l�i�����������^S��pOK_����������AV�W���]o��������ֿ��qn���xRZut������������������K+�_DM����Y�_�_���������մ������6����}���������&�P�D=���Xk־�t�����������_��;[lV��?��]'[�n�_���_�W��Ѝ4�]SM~;k!�>K�_���������i�� �'��5�=J����_��������    ��hDDk�����������8�kk
?����_������`�DԄNŗ��������������������������������}{ ������������������������������������������d�����������������������������������{������������޿����%��4 &���w����v�B"""#�"""""""""""""?���:���<~%���3�
4~M�3������E�\!)gw��ǙqM�4�F�=|�F��³腢�)�_/���SGfyT��]�X��1�h���M��7Oߝ�2f�yYq->�H,����`�A���o_���=5��}RlV��ҽ_���������ʑ������3Y;8�E��/Dv`�3��<?��8uT�V������S�Q�Ǚ��m�3���2s63B��%�3~��E�E�px<�����s� B��반�{�XJ��/�3�l�r6��(�;#���8��͙�f� �$F�5�i}���?�F����?�==g��p�;S\���-�ܷr��F��]���g�����o_W��T��#�G�
k�Zuh��@��hϖ�4i0�(�ѡ��o�&��}�3���M����5�R���_�M�6G�n����&�������ѝ�gs;��o�gp�f�3�xu3��ѣO�ֿ�_��ӯ����C�}k�����W�������n�'�w�s�ه�     j�>4��_O���k"��kI���د�ۯ��𑻏��{���q2���������8���~������f��������?������}�����~�~����!���������_��0�Yu���������������l���0�����!����������⦟ׯ��ԏw��u��q��7����0���������
�����~����i���]�������zz�������?���_:��������۽z�J�_����������{�������щ&*�8��د��>�������G��)�u�������v�����������K��b�Э��K�M5L ���)�_�1������+1��u_�\ƞ��aX��6)���?�)�b��*��������~�*�����a4�S�B"#�?���ݮ����N>?c�����������ߦ�������ܣ�� ������b��!u�GM� �����������3������CS#��_�ȷ���gb>� �ת_8����ݡ&�`AՑ�]���9�dc8�f�+�a�6OC��Ghl0
fap����h����Y���6:
�`T�th_�DD��(@�`r?;t[
��a�gsq�r�V�׵ f
���
��}�;�ʂ��JfVs��B�([u"f�9N@��e�܁A���`���]E���    W����,sO$Gb�w�o��C6ȉ4,��E&o)*�2�H�kz �*
�k�FZ����Ԉ* ��3�eG�靅�轧4f��� /���#ˣC����.����Hϣ��=��F�_1�&b=-���>�D~���z>��
�o���sq�9�'��3��x ˙r6͑�_6���a3L �!� ���qa;͇    �L���)pKL��s��(vn>����IapM����e�xN�B-#ԩ��H���A�v���};��Պ����_���.4˒j�'���]��H��þwu�,s>�����g�9�ִ�љ�ϙ�)zI<ϙ�?��>a�3���h�0��ǣ>��X�0�_������F{H��Z��9����-+ ����ե����#��u8��x���|a����t�����~>����U~����}{֔P��������׾���z�����Dy��ő��Ov���{��`������������>������?��Pa��a�4��W0�_�M���{��?�V�U�4}?ۏ�������KF�������΁�ቑ��}��&�4���_�#�����_�:�s1�E� �6͙��p�8�"Y�M4Xy���g������%�{������ϫ^�?�x"?�F?��<��������/������������^��������c�����^߳����z������/�0�����o�ݏ�8����E���-�&��p��}�)������?����66=��D�ű��:ݍ���s��~��~�o��^���_������4������t�����x���w��^*#���v�iݧv��M a0�4"M�a��� !g�B""���0�������������b��*��}��OM4
2㈈��DqG�"8�!�DP�������$��o �qY-K�^������ƋS>���E�<WV�����D0�������-W�q�S��Z��%�Z���������L|َ��w�����j�ѝ��4��k���y�ɰ`���2���u_�׷���5�9���3�̆D1N��`�    ��뿶���T]��&�������B @�B ��O������"���b����M}4v������O�[YWc馚U��O����[����    ��ap���5^Eƈ��������E�D��Y+�fJ܎n��;�O�u �ui>��L����[����Uuw��GL࿨0��KK����G+ ��|�L�vvH2s'�ڥ$?�J�?��i��C���!�@�L ��Z���}�t/��1fNPd�NF�Cd�fD6fXA�׿A��A��%���%��w �    �v�������U�^���w֣o��5�M4�US����mI�D�.ܛ���׵J����iɏDݪ�n����rs(w.�P�Z����J���6�#1�\!�6�G�q�������;�����Ӫӭ7�z_I?]j8���u%��#
���4�U�׿O�iw�����̂�5��")��=�M���M�*ſ�#<���ת}�I���I��1�0�.����mUu�
30��ksJ�#    J�C�=2XEgf;���p�#�:+(F�\z��E������4�ꉏU_��W�w%h��"Q���ֻ����i7���-�^F�ү~������b���D����Dv=zX�*W�"8�_֖:GO�q��\���2?W_��u�_�7饼���>N����?� �O�ү��a�!'Y���%�� ^�����K��7�֩S~��k�fJ������=�}�M�"Ç��_������7�z��w�}��-��JK���]��� C�7�Eˏ��������N��C��V�P���+�����
��0���/G����wտ������e    /�ix�ؤ�_i���3�O�*4��o{կQ��K����ޛ�~Ӵ׾��a��w�����U߯��0?�����u�H
b����M}l,0����m��M���a���v��ujNe
I���%kد�+�)��    ��0��h0D#��x'���=_�H�M��G�VǴ;�^���U�a:��v>��[i��ޝ����^O�    �h0�A��������O�׆�m4Ӵ�4���F�DDG��xB�-DDA�!�|�w��"#�_��������a������������!2�.!�GE�&��G�����EX�لk�s��L
@���8����o��ԁ(� A9���e��?��j�HB�C�M���
�[R��!����C9Mfڳ�Pqs2���A�����Y� �]��2|��D��1Ta�B3Do��2��P��dI�-�_�0��ծ��i����:g2e��eT�E�ӊi���?��K~���n�7b��s63��vl�v]�3�|��3 �.͚�L����P���[��o��
3�h$�O    ��U;�q�ޚ�wv���
`�e��l���ˌ�ds    �?�����ܦ/9�#�Nytr6Y��˙�0z_���F{H��#=��]���ў��jx[;�gp����X�wwh_�@��H~� D{��D�6H3 �a3?    �
�2�0?0G���D}%�"<����_�b��ߺ��k�����i��|�g��;��<ϙ�8Uj��|�)�;�'w�l<o�ݣ�F}������w�<g�*�F~`���O�l��ҫ
���},{�?k���qB��w����W�=.�0D{��W�g���o_�+��G����X��~6�����[�_�/�D��>���5t�����U�Oڏ8���Ն��#�6Q��=����1�o���������z3��0��|o�x/����0_��`������ 7�u����4����������/�ȇ��<7Q��7�F�� ���џ���1�߂)߄P���]��:b��r���]={/S��}u���?��>�����~o������}���T0ECmc�^8��ba�Ʊ�����b�����"<����"<����_���]ֽ�{���0����">�6����B�!=;���Mm4�{$馃^�$�i����s��~��s��cccb���w�ڗ�\��G�[���t�x����☙�0�DDDDDDDDDDlDDDDDDE�P�B"�=�`��L&W��1^�q�ӵ��Q��zi�q�ӴQ�p�    �Y��E'��0�a;B"Ͱ��O�����F*��0�� !����������-!�E2���4l>��C�_�c    �31�?���ft#�f`�Gf��>��aa5�k!a�H�9 S�8.C�<!�8@�
4-=>�?^����p`�� �0�L�]띣%�2t“�n�8jd�ߘ�����E����3m;L�rL���$��Dh3�#�;�"�"$�����D�1LV��Zɖv����H���T��EQ#����CI�#w!��zl'D�[��� �Ϗ3�A�fu��"�O    ���C""Jqűk�Ċ'�A�'�<ԟF_w���"#���rc�Gֿ���'�
�᪫��?���% ���4�}~���    k�c��yc��>��{��c�����B}[��_W���u���Idu��&��饫���i���q�;������}.���tN�_�h�t����9p��V+��[��U�D1���q}�h�N������� ޿������~����4�e�i�������]�_���V���Z}��]�~�a�D!�D����������H���ʉ�K�c�_�TT��^�� {k���I�o�O��ݯ����K�C��+c�_��+��0���A����kߥ�������B1�C0�?����^J�5T�T�MS������p�v��T!DDDDDo��DDDDD�����������/�'F��׿�Ó��8a3;�9�UY�]�3���kH��9�>f��� ς��̌ȢM4�Z���zA�����%2��B|��] r�1�\�q�a0�z���U��ǧ��T�&�i�i�v���MiQ1ܞ�w�������uO����0:~�.��j���������$�;�J�̘4d��vN�i��p�;�p´���.)s3#�A��pS��)v`������4Q4h?�hC����_��n%�B,&O�N#A��3��~�_�Aiw[�_H�Lz��=����$�_������c��Ɏ�������[��G�c�
w��=o��c���    ����X�4M��˿�A�� �c�{����L.�a<���vM˰���X�?���a�c�}� � ��گ��]��1ߎ�z���׽��^����[�u��Lq��/Mq�ԖO    ��oi_���
  • June 10, 2015
  • Like
  • 0

Dear Gurus,

 

I have a trigger that I am doing some summary counts on some lookup records(non master detail). My trigger processes fine with the trigger.new records. I am having trouble properly running the same process against a value in the trigger.old context. Since the trigger does not persist to the database prior to the entire trigger completion, I think my aggregate results are the same for both calls to the trigger utility class. How can I process the trigger.old request(second line in the trigger) against the records after they have updated. I am trying to update/refresh the old record count on the Trailer object with the correct count value after the new records are updated. Any help is appreciated....current code is below:

 

trigger ManifestUpdateTrailerContainerInfo on Manifest__c (after delete, after undelete, after update) {

    ManifestContainerInfoTriggerUtil.updateContainerCounts(Trigger.New);
     ManifestContainerInfoTriggerUtil.updateContainerCounts(Trigger.Old);

}

 

 

public with sharing class ManifestContainerInfoTriggerUtil {
    
    public static void updateContainerCounts(List<Manifest__c> lstManifest)    {
        
        Integer containerCount = 0;
        id trailerToUpdate;
        List<Trailer__c> lstTrailersToUpdate = new List<Trailer__c>();
    
        //new trailer collection
        Set<Id> ids = new Set<Id>();
    
          for (Manifest__c mf : lstManifest) {
              ids.add(mf.id);
          }
          
        //new counts
        AggregateResult[] counts = [SELECT Manifest__c ,count(id)containers FROM Container__c WHERE Manifest__c IN :ids GROUP BY Manifest__c];
        
        for(AggregateResult ar : counts){
            for(Manifest__c m: lstManifest){
                if(ar.get('Manifest__c') == m.Id && m.Trailer__c != null) {
                     trailerToUpdate = m.Trailer__c;
                    containerCount = integer.valueof(ar.get('containers'));
                    lstTrailersToUpdate.add(new Trailer__c(Id=trailerToUpdate, Container_Count__c = containerCount));
                }
            }
        }
        update lstTrailersToUpdate;
    }
        
}

 

  • November 07, 2013
  • Like
  • 0

I am trying to use some code from this post. I am trying to write a trigger that allows for bulk processing of counting attachments associated to a record based on the record change(not addition of the attachment). Below is my code that compliles, but I get a runtime error "Apex trigger WasteProfileAttachmentCount caused an unexpected exception, contact your administrator: WasteProfileAttachmentCount: execution of BeforeUpdate caused by: System.DmlException: Update failed. First exception on row 0 with id a0fa0000006j8IAAAY; first error: SELF_REFERENCE_FROM_TRIGGER, Object (id = a0fa0000006j8IA) is currently in trigger WasteProfileAttachmentCount, therefore it cannot recursively update itself: []: Trigger.WasteProfileAttachmentCount: line 30, column 1"

 

I understand that I am not supposed to explicitly call update, on the same record. But how can I update in bulk?....below is the code.

 

trigger WasteProfileAttachmentCount on ProfileDocument__c (before update) {

    Set<Id> ids = new Set<Id>();
    ids.addAll(trigger.newMap.keySet());
    
    AggregateResult[] counts = [SELECT ParentId,count(id)attachments FROM Attachment WHERE ContentType = 'application/pdf' AND ParentId IN :ids GROUP BY ParentId];   
    
    List<ProfileDocument__c> toUpdate = new List<ProfileDocument__c>();
    
    for(AggregateResult ar : counts){
        ProfileDocument__c tempDocs = new ProfileDocument__c(Id=string.valueof(ar.get('ParentId')),Attachments__c=integer.valueof(ar.get('attachments')));
        toUpdate.add(tempDocs);
    }
    
    update toUpdate;

}

  • August 14, 2013
  • Like
  • 0

I have a VF page, my page block table is rerendering fine(table), however my Output Panel(panelWrapper) is not rerendering unless I do a full page refresh. I have tried wrapping the output panel at the pageblock level as well, and it still won't re-render properly. Any ideas would be appreciated. 

 

Thanks

 

<apex:page controller="ManifestMaintenanceController2">

<script type="text/javascript">
    function checkAll(cb,cbid)
        {
            var inputElem = document.getElementsByTagName("input");                    
            for(var i=0; i<inputElem.length; i++)
            {            
                 if(inputElem[i].id.indexOf(cbid)!=-1){                                       
                    inputElem[i].checked = cb.checked;
                }
            }
        }  
</script>

      <apex:form id="form">
            
   
          <apex:pageBlock id="block">
          
              <apex:pageBlockButtons >
                  <apex:commandButton value="Remove from Manifest" action="{!processRemoveSelected}" rerender="panelWrapper, table"/>
                   <apex:commandButton value="Return to Manifest" action="{!pageCancel}"/>
              </apex:pageBlockButtons>
                 
                  
                 <apex:outputPanel id="panelWrapper">
                 <apex:outputText style="font-style:italic" value="{0} Manifest Lines available to remove.">
                          <apex:param value="{!workOrderCount2Remove}"/>
                      </apex:outputText>
                </apex:outputPanel>
     
              <!-- In our table we are displaying the cServiceOrderLine records -->
              <apex:pageBlockTable value="{!serviceOrderLines2Remove}" var="c" id="table">
                  
                    <apex:column ><apex:facet name="header">
                      <!-- This is our selected Boolean property in our wrapper class -->
                      <apex:inputCheckbox value="{!c.selected}" onclick="checkAll(this,'checkedone')" />
                         </apex:facet>
                         
                        <apex:inputCheckbox value="{!c.selected}" id="checkedone"/></apex:column>
                 
                 
                  <!-- This is how we access the records within container/wrapper -->
                  <apex:column value="{!c.con.Name}" />
                  <apex:column value="{!c.con.SVMXC__Activity_Type__c}" />
                  <apex:column value="{!c.con.SVMXC__Line_Type__c}" />
                  <apex:column value="{!c.con.SVMXC__Line_Status__c}" />
                  <apex:column value="{!c.con.SVMXC__Received_City__c}" />
                  <apex:column value="{!c.con.SVMXC__Quantity_Shipped2__c}" />
                  <apex:column value="{!c.con.SVMXC__Service_Order__c}" />
                  <apex:column value="{!c.con.SVMXC__Work_Description__c}" />
              </apex:pageBlockTable>
        
          </apex:pageBlock>
                         
     </apex:form>
</apex:page>

  • April 09, 2013
  • Like
  • 0

Hi ,

 

I am quite new to Saleforce. I did quite a bit of search in the community but could not find what i was looking for.

 

We have the following requirement - need to create a .net based application that will pull data records ( Contacts , Products , Feedback etc) / information from the salesforce env and export it to another system. The data volume might be quite large as we have a lot of instances or per country data. Expected volume for some of the countries will cross 300000. 

 

Initially we decided to use the Apex Api Soap service calls to retrieve the information. But we found that there is a limit in terms of the number of records that are retrieved per service request.i.e only 1000 records are returned per call, and we will need to make subsequent calls to get this remaning information. Worst part is that there is also a hard limit on the number of calls made (10000 per day). Can anyone suggest the best approach to get this done?  

 

Cheers,

Ashwin

 

 

I am trying to return the disctinct number of months in the last 24 months that we have an invoice line item record. The below query returns me the disctinct number of InvoiceDate values, but I just need the disctinct months(not individul dates). So my count should never be over 24. Any suggestions?

 

AggregateResult[] activePeriodCount = [SELECT account__c aid, COUNT_DISTINCT(InvoiceDate__c) ap FROM InvoiceLineItem__c where Account__c IN :setAccountId AND InvoiceDate__c != NULL AND Revenue != NULL
                                        AND Revenue!= 0 AND InvoiceDate__c =  LAST_N_YEARS:2  GROUP BY Account__c];

 

Another option is to do 24 queries with the invdividual months applied to the query, but I am trying to avoid that.

 

Thanks
       

  • March 06, 2013
  • Like
  • 0

Hi,

 

I have generated an Apex class from a WSDL. I tried to call my webservice method in developer console but it gives me weird exception:

 

System.CalloutException: Web service callout failed: WebService returned a SOAP Fault: Server was unable to process request. ---> Value cannot be null.Parameter name: username faultcode=soap:Server faultactor=

 

I have tested this same SOAP webservice in soapUI 4.5.1 (http://www.soapui.org/) and it worked perfectly fine there with exact set of input parameters as in salesforce.

 

Can anybody help.

 

Thanks

I tried installing the force.com ide standalone installer but its just a waste of time and does not work properly. I have spent more than half a day trying to get this right and i have had to abandon this as its just not productive. I have hit 3 different errors from installation to trying to get a project up and editing its contents or syncing to the server.

 

here are the 3 errors encountered. Currently only 1 remains that i just dont have the courage to fix now.

 

1. java.lang.runtimeexception: application "" could not be found in the registry force

 

this error happened after installing force.com ide. I found that i needed to change the config file to get it working

 

2. com.salesforce.ide.aip.metadata.types.Metadata$JaxbAccessorF_fullName cannot be cast to com.sun.xml.Internal.bind.v2.runtime.reflect.Accessor

 

this happened after i upgraded the force.com ide i think and i had to add -clean to another .ini file so the force.com ide could boot properly to the workspace

 

3. same error as 2 but now i am trying to add/remove components to a project i have created but that does not work. Trying to look at existing project components also throws an error.

 

 

All i want to do is try using the force.com ide to follow the developer training course but i think i would be just better off doing the inline apex editing and hope to save before hitting Backspace accidentally on the browser page and loosing all edited code after the last Quick Save.

 

Does anyone know a 100% sure way of getting force.com ide to work without having to troubleshoot this stuff every 10 minutes?

 

Thanks\

 

A

Dear Gurus,

 

I have a batch class which works properly for the most part. One small issue is that I am getting System.LimitException: Too many query rows: 50001

Per the docs this should not happen because I am querying everything into a list and processing off the list. Can someone explain a work around or whats wrong with the code. The error occurs on the query line.

 

Any help is appreciated

 

/*This class rolls up invoices for all accounts and calculates a monthly average based on the invoice amounts/months and years queried.

 

 

global class UpdateInvoiceForecastAverages implements Database.Batchable<sObject> {
    
    //private final string strQuery;    
    global final string strQuery;  
    
    global UpdateInvoiceForecastAverages(String query)  {  
        this.strQuery = query;
        }
       
    //Execute the query.
    global database.querylocator start(Database.BatchableContext BC) {
        return Database.getQueryLocator(strQuery);
    }


    global void execute(Database.BatchableContext BC, List<sObject> scope){
        
        //get custom setting params
        Account_Forecast_Date_Parameter_Config__c paramConfig = Account_Forecast_Date_Parameter_Config__c.getValues('UpdateInvoiceForecastAverages');
        Integer startYear = Integer.valueOf(paramConfig.Start_Year__c);
        Integer endYear = Integer.valueOf(paramConfig.End_Year__c);
        Integer yearDiff;
        
        //calculate year range from custom setting params
        if (endYear == startYear) {
            yearDiff = 1;
        }
         else {
        yearDiff = (endyear - startyear) + 1;
         }
        
            //Maps to store Account Id and Related Invoices
        Map<Id, List<ESDInvoice__c>> mapInvoiceByAccount = new Map<Id, List<ESDInvoice__c>>();
        List<Account> lstAccountToUpdate = new List<Account>();
        set<Id> setAccountId = new set<Id>();
        
        //Collect Account Id's
        for(sObject sobjAccount : scope){
            Account objAccount = (Account)sobjAccount;
            setAccountId.add(objAccount.Id);    
        }
        
        //Retrieve Invoices
            
        
         for (List<ESDInvoice__c> lstInvoices : [SELECT Account__c, PostPeriod__c, InvoiceTotal2__c From ESDInvoice__c e  WHERE Account__c IN :setAccountId
                                        AND PostPeriod__c != NULL AND InvoiceTotal2__c != NULL
                                        AND InvoiceTotal2__c != 0 AND CALENDAR_YEAR(PostPeriod__c) >= :startYear AND                                                     CALENDAR_YEAR(PostPeriod__c) <= :endYear]){
                                        
            for(ESDInvoice__c objInvoice : lstInvoices){    
                if(NULL != objInvoice.Account__c){
                
                                            
                //if(NULL != objInvoice.Account__c){
                    if(!mapInvoiceByAccount.containsKey(objInvoice.Account__c))
                        mapInvoiceByAccount.put(objInvoice.Account__c, new List<ESDInvoice__c>());
                        mapInvoiceByAccount.get(objInvoice.Account__c).add(objInvoice);
                    }
                }
            }
            
        if(mapInvoiceByAccount.size() > 0){
            //Iterate through map and collect each months total
            for(Id idKey : mapInvoiceByAccount.keySet()){
                //Initialize variables
                Decimal dJanTotal = 0; Integer iJanRecordCount = 0;
                Decimal dFebTotal = 0; Integer iFebRecordCount = 0;
                Decimal dMarTotal = 0; Integer iMarRecordCount = 0;
                Decimal dAprTotal = 0; Integer iAprRecordCount = 0;
                Decimal dMayTotal = 0; Integer iMayRecordCount = 0;
                Decimal dJunTotal = 0; Integer iJunRecordCount = 0;
                Decimal dJulTotal = 0; Integer iJulRecordCount = 0;
                Decimal dAugTotal = 0; Integer iAugRecordCount = 0;
                Decimal dSeptTotal = 0;Integer iSeptRecordCount = 0;
                Decimal dOctTotal = 0; Integer iOctRecordCount = 0;
                Decimal dNovTotal = 0; Integer iNovRecordCount = 0;
                Decimal dDecTotal = 0; Integer iDecRecordCount = 0;
                
                List<ESDInvoice__c> lstInvoices = mapInvoiceByAccount.get(idKey);
                if(lstInvoices.size() > 0){
                    for(ESDInvoice__c objInvoice : lstInvoices){
                        //If Jan
                        if(objInvoice.PostPeriod__c.month() == 1){
                            dJanTotal = dJanTotal + objInvoice.InvoiceTotal2__c;
                            iJanRecordCount++;
                        }
                        
                        //If Feb
                        if(objInvoice.PostPeriod__c.month() == 2){
                            dFebTotal = dFebTotal + objInvoice.InvoiceTotal2__c;
                            iFebRecordCount++;
                        }
                        
                        //If Mar
                        if(objInvoice.PostPeriod__c.month() == 3){
                            dMarTotal = dMarTotal + objInvoice.InvoiceTotal2__c;
                            iMarRecordCount++;
                        }
                        
                        //If Apr
                        if(objInvoice.PostPeriod__c.month() == 4){
                            dAprTotal = dAprTotal + objInvoice.InvoiceTotal2__c;
                            iAprRecordCount++;
                        }
                        
                        //If May
                        if(objInvoice.PostPeriod__c.month() == 5){
                            dMayTotal = dMayTotal + objInvoice.InvoiceTotal2__c;
                            iMayRecordCount++;
                        }
                        
                        //If June
                        if(objInvoice.PostPeriod__c.month() == 6){
                            dJunTotal = dJunTotal + objInvoice.InvoiceTotal2__c;
                            iJunRecordCount++;
                        }
                        
                        //If July
                        if(objInvoice.PostPeriod__c.month() == 7){
                            dJulTotal = dJulTotal + objInvoice.InvoiceTotal2__c;
                            iJulRecordCount++;
                        }
                        
                        //If Aug
                        if(objInvoice.PostPeriod__c.month() == 8){
                            dAugTotal = dAugTotal + objInvoice.InvoiceTotal2__c;
                            iAugRecordCount++;
                        }
                        
                        //If Sept
                        if(objInvoice.PostPeriod__c.month() == 9){
                            dSeptTotal = dSeptTotal + objInvoice.InvoiceTotal2__c;
                            iSeptRecordCount++;
                        }
                        
                        //If Oct
                        if(objInvoice.PostPeriod__c.month() == 10){
                            dOctTotal = dOctTotal + objInvoice.InvoiceTotal2__c;
                            iOctRecordCount++;
                        }
                        
                        //If Nov
                        if(objInvoice.PostPeriod__c.month() == 11){
                            dNovTotal = dNovTotal + objInvoice.InvoiceTotal2__c;
                            iNovRecordCount++;
                        }
                        
                        //If Dec
                        if(objInvoice.PostPeriod__c.month() == 12){
                            dDecTotal = dDecTotal + objInvoice.InvoiceTotal2__c;
                            iDecRecordCount++;
                        }
                    }    
                }
        
        /* For testing yeardiff for multiple year calc */
        
                Decimal dFinalJanAvg = iJanRecordCount == 0 ? 0 : dJanTotal/yearDiff;
                Decimal dFinalFebAvg = iFebRecordCount == 0 ? 0 : dFebTotal/yearDiff;
                Decimal dFinalMarAvg = iMarRecordCount == 0 ? 0 : dMarTotal/yearDiff;
                Decimal dFinalAprAvg = iAprRecordCount == 0 ? 0 : dAprTotal/yearDiff;
                Decimal dFinalMayAvg = iMayRecordCount == 0 ? 0 : dMayTotal/yearDiff;
                Decimal dFinalJunAvg = iJunRecordCount == 0 ? 0 : dJunTotal/yearDiff;
                Decimal dFinalJulAvg = iJulRecordCount == 0 ? 0 : dJulTotal/yearDiff;
                Decimal dFinalAugAvg = iAugRecordCount == 0 ? 0 : dAugTotal/yearDiff;
                Decimal dFinalSeptAvg = iSeptRecordCount == 0 ? 0 : dSeptTotal/yearDiff;
                Decimal dFinalOctAvg = iOctRecordCount == 0 ? 0 : dOctTotal/yearDiff;
                Decimal dFinalNovAvg = iNovRecordCount == 0 ? 0 : dNovTotal/yearDiff;
                Decimal dFinalDecAvg = iDecRecordCount == 0 ? 0 : dDecTotal/yearDiff;
        
        
                lstAccountToUpdate.add(new Account(Id = idKey, Invoice_Line_Item_Avg_Jan__c = dFinalJanAvg, Invoice_Line_Item_Avg_Feb__c = dFinalFebAvg, Invoice_Line_Item_Avg_Mar__c = dFinalMarAvg, Invoice_Line_Item_Avg_Apr__c = dFinalAprAvg, Invoice_Line_Item_Avg_May__c = dFinalMayAvg, Invoice_Line_Item_Avg_Jun__c = dFinalJunAvg, Invoice_Line_Item_Avg_Jul__c = dFinalJulAvg, Invoice_Line_Item_Avg_Aug__c = dFinalAugAvg,  Invoice_Line_Item_Avg_Sept__c = dFinalSeptAvg, Invoice_Line_Item_Avg_Oct__c = dFinalOctAvg, Invoice_Line_Item_Avg_Nov__c = dFinalNovAvg, Invoice_Line_Item_Avg_Dec__c = dFinalDecAvg));
            }
        }
        
        try{
        if(lstAccountToUpdate.size() > 0)
            update lstAccountToUpdate;
        }
        catch(exception ex){
            system.debug('Exception Message :: ' + ex.getMessage());
        }
    }    
    
    global void finish(Database.BatchableContext BC)  {  
system.debug('Batch Complete');
    
        
    }
}

  • December 03, 2012
  • Like
  • 0

Hi,

 

I wish to setup SSO using SAML in the Salesforce Org, so that I can authenticate from a Rails app (deployed on Heroku) and perform some REST API calls from the Rails app.

 

I am very new to Salesforce, but I am aware of where to setup the SSO/SAML for the Org (Setup->Security Controls->SSO) but, I am not sure what I should be handling at the Rails app side for the authentication to work.

 

1. What are the required steps/components to be implemented on the Rails app side so that it can work with SSO/SAML setup on the Salesforce side.

 

2. Also is it possible to set multiple SSO / SAMLsettings in Salesforce?

 

3. How to generate the certificate required for configuring the above SSO / SAML settings in Salesforce?

 

Any help would be higly appreciated!

 

 

 

Hey all.

Create a new trigger that should create a task for a person when another type of object is created. Problem is, when I attempt to get values from a related object that I need to create the task, they always come back as null. The relationship field itself has a value, but reading and values by accessing that relationship is null.

 

EX

object.relationship__c = a0UR0000002QiRH

object.relationship__r.id = null

 

Those should both point to the same thing! Why is the latter null? 

 

 

trigger createChangeOrderTask on Project_Change_Order__c (after insert) 
{
	//List of tasks to create
	List<Task> tasks = new List<Task>();
	
	//List to hold user IDs
	Map<string,id> userMap = new map<string,id>();
	
	//Find all users and add their email and ID to a map (so we can find user ID based on email later)
	for(user u : [select Id, email from user])
	{
		userMap.put(u.email,u.id);	
	}
	
	system.debug('Users:' + userMap);
	
	//For all the change orders that got passed in, iterate
	for(Project_Change_Order__c co : Trigger.new)
	{

		Task thisTask = new Task();
        
        //The project manager field is a contact, but a task requires a user. So based on the users email
        //field, find the user with the same email, and use that ID		
		thisTask.OwnerId = userMap.get(co.bid__r.Project_Manager__r.email);
		system.debug('Related To Bid:' + co.bid__c);
		
		//All these debugs return null. WHAT?! That is impossible.
		system.debug('Bid ID (read from object):' + co.bid__r.id);		
		system.debug('Bid Name:' + co.bid__r.name);
		system.debug('Project Manager ID:' + co.bid__r.Project_Manager__c);
		system.debug('Project Manager Email:' + co.bid__r.Project_Manager__r.email);
		system.debug('Found Owner ID:' + thisTask.OwnerId);
		
		//If we were able to find a person to assign the task to, populate the rest of the taks data
		if(thisTask.OwnerId != null)
		{
			thisTask.subject = 'New Change Order For '+co.bid__r.name;
			
			//Create a date based on the datetime
			thisTask.ActivityDate = Date.newInstance(co.Due_Date__c.year(),co.Due_Date__c.month(),co.Due_Date__c.day());
			thisTask.Description = co.Detail__c;
			thisTask.ReminderDateTime = co.Due_Date__c;
			thisTask.WhoId = co.Client_contact__c;
			thisTask.IsReminderSet = true;
			
			tasks.add(thisTask);
		}
		else
		{
			system.debug('Could not find user with matching email as project manager. No task created.');
		}
	}
	insert tasks;
	
}

 

 

 

 

Sigh, so I've hit another odd error with not much to be found on google. I have a simple aggregate query that effetivly acts as a rollup.

 

 

	        AggregateResult[] campaignTotals = [select  SUM(Actual_Male_Quota__c)males, 
	                                                    SUM(Actual_Female_Quota__c)females, 
	                                                    SUM(total_Respondents__c)total, 
	                                                    SUM(Total_Master_Caller_Recruits__c)caller,
	                                                    SUM(Total_Master_IVR_Recruits__c)ivr,
	                                                    SUM(Total_Master_Web_Recruits__c)web,
	                                                    parentId 
	                                                    From Campaign 
	                                                    where isActive = true and 
	                                                    recordTypeID = :ParentRecordType.id and
	                                                    parentId != null
	                                                    group by parentId 
	                                                    LIMIT 500];

 

 

And I'm getting the error

 

Failure Message: "System.Exception: Aggregate query does not support queryMore(), use LIMIT to restrict the results to a single batch", Failure Stack Trace: "Class.UpdateTopLevelCampaignCounters.updateCountersTrigger: line 14, column 45 Class.unitTests.testUpdateUmbrellaCounters: line 335, column 36 External entry point"

 

I decided to include a limit statment (even though I think that would basically cause this query to be useless since it will likely return junk results but as a test I figured it was worth it. That still didn't resolve it. Is the limit lower? Is there something else I should be doing here instead? Below is the full code for the trigger.

 

 

    WebService static boolean updateCountersTrigger()
    { 
    	try
    	{
	    	RecordType ParentRecordType = [select id from RecordType where name = 'FPI Parent Campaign'];
	    	Campaign[] updateCampaigns = new Campaign[]{};
	        AggregateResult[] campaignTotals = [select  SUM(Actual_Male_Quota__c)males, 
	                                                    SUM(Actual_Female_Quota__c)females, 
	                                                    SUM(total_Respondents__c)total, 
	                                                    SUM(Total_Master_Caller_Recruits__c)caller,
	                                                    SUM(Total_Master_IVR_Recruits__c)ivr,
	                                                    SUM(Total_Master_Web_Recruits__c)web,
	                                                    parentId 
	                                                    From Campaign 
	                                                    where isActive = true and 
	                                                    recordTypeID = :ParentRecordType.id and
	                                                    parentId != null
	                                                    group by parentId 
	                                                    LIMIT 500];
	        
	        //Loop over the aggregate result set
	        for (AggregateResult ar : campaignTotals) 
	        {   
	            Campaign thisCampaign = new Campaign(Id=String.valueOf(ar.get('parentId')));
	            thisCampaign.Total_Project_Males__c = double.valueOf(ar.get('males'));
	            thisCampaign.Total_Project_Females__c = double.valueOf(ar.get('females'));
	            thisCampaign.Total_Project_Caller_Recruits__c = double.valueOf(ar.get('caller'));
	            thisCampaign.Total_Project_IVR_Recruits__c = double.valueOf(ar.get('ivr'));
	            thisCampaign.Total_Project_WEb_Recruits__c = double.valueOf(ar.get('web'));
	            thisCampaign.Total_Project_Respondents__c = double.valueOf(ar.get('total'));
	            thisCampaign.Global_Counters_Last_Updated__c =System.now();
	            //Add this new account to the list of account objects
	            updateCampaigns.add(thisCampaign);
	        }
	    
	        //Update the account object.
	        update updateCampaigns; 
	        return true;     
    	}    
        catch(Exception e)
        {
        	return false;  
        }
    }

 

 

This is my first APEX coding... and, I need a bit of help. 

 

I am trying to count the # of related records...

 

I'd then, like to make a field on the current record equal to this count.

 

The following seems to work well... except I don't know how to limit the select statement to where the related_id = the id of the current record.  How do I make the variable "sid" = the id on the current record on the object Students?  Also, do I need a "loop" -- if so, how would this look?

 

Many thanks!

 

trigger CountRelatedCallLogs on Student__c (before insert, before update) { Student__c[] s = Trigger.new; String sid = null; Sid = s.id; LIST <Student_Call_Log__c> log = [SELECT Id, Related_Student__c, Date__c, Note__c FROM Student_Call_Log__c clog WHERE Student_Call_Log__c.Related_Student__c = :sid ORDER BY Related_Student__c, Id DESC LIMIT 1000]; s[0].Call_Count__c = log.size (); s[0].Most_Recent_Call_Note__c = sid(); }

 

 

  • January 19, 2010
  • Like
  • 0
Hello there,
I wanted to find out the max(of a list of Dates) .e.g: Select PSOD_Project__r.Name,Resource__r.Name,max(Period_Beginning__c) from Time_Sheet__c where PSOD_Project__r.Name = 'PSOD Internal'

This is not working; Any hints whether this is feasible at all in SOQL ? if so, help pls.



Thanks,
Arun B