• Rajus
  • NEWBIE
  • 30 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 3
    Likes Received
  • 0
    Likes Given
  • 14
    Questions
  • 11
    Replies
Hi All,
I am getting some un expected characters in word document some thing like below.

•Hospital
•Clinic
•Nursing Home
•CRO

I tried all possible ways to get rid of this issue but no use.Can any one please help me out to sort out this issue.
Follwoing is my visualforce code:
<apex:page standardcontroller="Business_Requirement__c" standardStylesheets="false" showheader="false" contentType="application/rtf;charset=ISO-8859-1#Word_Document.doc" extensions="GenerateReport_BR" cache="true">
    <html xmlns:w="urn:schemas-microsoft-com:office:word">
    <apex:outputText value="{!PrintView}" escape="false"/>
    <body>
    <h2>Business Requirement</h2> 
    <h3>This section of the User Requirement Specification contains all of the business requirements of the system.
    These requirements are written at a level of detail sufficient to enable designers to design a system that will
    satisfy those requirements and testers to test that the system satisfies those requirements.
    (Static from one of the field from Release Plan)</h3>
    <table width="100%" border="1" cellspacing="0" cellpadding="0" >
            <tr>
                <th>BR#</th>
                <th>Requirement Summary</th>
                <th>Use Case</th>
            </tr>
            <tr>
                <td>{!CMAX__Business_Requirement__c.Name}</td>
                <td><apex:outputtext escape="false" value="{!CMAX__Business_Requirement__c.CMAX__Business_Requirements_Summary__c}"/></td>
                <td><apex:outputtext escape="false" value="{!CMAX__Business_Requirement__c.CMAX__Use_Case__c}"/></td>
            </tr>
    </table>
</body>
     </html>
   
</apex:page>
Hi All,

I am getting some invalid images at the end of the MS-Word doc like below.

Invalid footer
I am using apex:page tag like below.
<apex:page standardcontroller="Account" contentType="application/msword; charset=Windows-1252" extensions="GenerateReport_BR" language="en" cache="true">

Can any one please let me know where i am doing mistake .

Thanks,
Raj.

Hi All,

I have one list some thing like below.
List<string> possiblevalues = new list<string>{'abc gh', 'def', 'ghi'};

and One string some thing like below
String str = 'Hello guys Hello world abc gh ';

Now i have to look for each string of possiblevalues in str.Is there any simple method to find out whether the string is present in the str or not.
I know the simple way which is,

for(string s:possiblevalues)
{
       if(str.contains(s);
            string matchvalue = s;

}
But this technique will loop through all elements of list.But i need more efficient way without using for loops for this.


If some one find the better approach pleas let me know.


Thanks,
Raj.
Hi All,
I am getting Parameter_Tampering Issue in my apex code when i submit package for security review.It is coming specifically when i use string.escapeSingleQuotes(variable) to avoid SOQL-SOSL injection.

Do any one have idea about How to get rid of this issue.It ll be more helpful to me.

Thanks,
Rajesh.

Hi All,

I have created one search functionality where users can select the filter criteria and fields to display in the search results,

In search results i want to provide a link for Name field .So that users can open that perticaular record.

I know how to it for static columns. It will be some thing like <apex:outputLink value="{!result.id}">{!result.Name}</apex:outputLink>

 

Now i want do like this for the Name field which will be selected dynamically.

Following is my visualforce code which i use to display the search results.

 

<apex:pageblockTable value="{!masterlist}" var="rec" rendered="{!if(masterlist.size>0,true,false)}">


<apex:repeat value="{!selectedfields}" var="FieldLable">

<apex:column value="{!rec[FieldLable]}" />
</apex:repeat>
</apex:pageblockTable>

 

So can any one please give any idea that where and how should i change the code .so that i can provid the link comfirtably.

 

 

Thanks,

Rajesh.

Hi All,

 

I am facing one issue since two weeks .The issue is i am not able to authenticate the amazon s3 Rest  request properly and getting the following error.

 

Error:The request signature we calculated does not match the signature you provided.Check your key and signing method.

 

Follwoing is my code:

String dateString = Datetime.now().formatGmt('EEE, dd MMM yyyy HH:mm:ss Z');
system.debug('=========='+dateString);
string stringToSign = 'GET\n\n\n'+dateString';
Blob mac = Crypto.generateMac('hmacSHA1', Blob.valueOf(stringToSign), Blob.valueOf('xxxxxxxx'));
stringToSign = EncodingUtil.base64Encode(mac);
//stringToSign = EncodingUtil.urlEncode(stringToSign, 'UTF-8');
httpRequest con = new HttpRequest();
system.debug('**********'+stringToSign);
con.setHeader('Authorization', 'AWS xxxxxx:'+stringToSign);
con.setEndPoint('https://s3.amazonaws.com');
con.setHeader('Host','xxxxx.s3.amazonaws.com');
system.debug('====date format'+dateString);
con.setHeader('Date',dateString);
//con.setHeader('Content-Type','application/xml');
con.setMethod('GET');
Http http = new Http();
HTTPResponse res = http.send(con);
system.debug('========'+res.getBody());

 

 

Can any one please help me out on this.

Thanx in advance.

Hi all,

 

I implemented a method to upload an Attachment to Amazon S3 but I'm having this issue : AWS authentication requires a valid Date or x-amz-date header

 

Any help is appreciated.

 

Attachment attachment = [Select Id, ContentType, Body, BodyLength from Attachment limit 1];
      //Set<Id> ids = new Map<Id,Attachment>(attachments).keySet();
      AWSKeys credentials = new AWSKeys('Keys');
      S3.AmazonS3 as3 = new S3.AmazonS3(credentials.key,credentials.secret);
      
      Datetime now = DateTime.now();
      String formattednow = now.formatGmt('yyyy-MM-dd')+'T'+now.formatGmt('HH:mm:ss')+'.'+now.formatGMT('SSS')+'Z';
      
      String stringtosign = 'PUT \n\n';
      stringtosign += attachment.ContentType + '\n';
      stringtosign += formattednow + '\n';
      stringtosign += '/mybucket/' + attachment.Id;
      Blob mac = Crypto.generateMac('HMacSHA1', blob.valueof(stringtosign),blob.valueof(as3.secret)); 
      String signature = EncodingUtil.base64Encode(mac);
      
      HttpRequest req = new HttpRequest(); 
 
     //Set HTTPRequest Method
     req.setMethod('PUT');
   
     //Set HTTPRequest header properties
     req.setHeader('content-type', attachment.ContentType);
     req.setHeader('Content-Length',String.valueOf(attachment.BodyLength));
     req.setHeader('Date', formattednow);
     req.setHeader('Authorization', 'AWS ' + as3.key + ':' + signature);
     req.setEndpoint('http://s3.amazonaws.com');
     
      try {
            Http http = new Http();
           //Execute web service call here      
           HTTPResponse res = http.send(req);
         
   } catch(System.CalloutException e) {
      System.debug('===================EXCEPTION ' + e.getMessage() + e.getStackTraceString());
   }  

 

Hi,

 

I have executed the following code which makes a call to Amazon web services and I have receieved the following exception: 

 

<Response><Errors><Error><Code>InvalidParameterValue</Code><Message>Value (2011-8-30'T'6:53:6.495'Z') for parameter Timestamp is invalid. Must be in ISO8601 format.</Message></Error></Errors><RequestID>41aa0620-6f49-48cb-aead-bed311db49d1</RequestID></Response>

 

It will be great if someone helps to fix this problem and also posts AWS S3 REST sample code. 

 

Please replace 'AWS Secret Key' and 'AWS KEY' values before executing this code.

 

public with sharing class S3Rest {

public static void testAlexaWSForAmazon() {

       // The date format is yyyy-MM-dd'T'HH:mm:ss.SSS'Z' 

       DateTime d = System.now();

       String timestamp = ''+ d.year() + '-' +d.month() + '-' +d.day() + '\'T\'' +d.hour() + ':' +d.minute() + ':' +d.second() + '.' +d.millisecond() + '\'Z\'';

       String timeFormat = d.formatGmt(timestamp);

       String urlEncodedTimestamp = EncodingUtil.urlEncode(timestamp, 'UTF-8');

       String action = 'UrlInfo';

       String inputStr = action + timeFormat;

       String algorithmName = 'HMacSHA1';

       Blob mac = Crypto.generateMac(algorithmName, Blob.valueOf(inputStr),Blob.valueOf('AWS Secrect key'));

       String macUrl = EncodingUtil.urlEncode(EncodingUtil.base64Encode(mac), 'UTF-8');

       String urlToTest = 'amazon.com';

       String version = '2005-07-11';

       String endpoint = 'http://awis.amazonaws.com/';

       String accessKey = 'AWS KEY';

       HttpRequest req = new HttpRequest();

       req.setEndpoint(endpoint +'?AWSAccessKeyId=' + accessKey +'&Action=' +

                                 action +'&ResponseGroup=Rank&Version=' +

                                  version +'&Timestamp=' + urlEncodedTimestamp +

                                  '&Url=' + urlToTest +'&Signature=' + macUrl); 

        req.setMethod('GET');

        Http http = new Http();

       try {

             HttpResponse res =   http.send(req);

             System.debug('STATUS:'+res.getStatus());

             System.debug('STATUS_CODE:'+res.getStatusCode());

             System.debug('BODY: '+res.getBody());

        } catch(System.CalloutException e) {

              System.debug('ERROR: '+ e);

         }

   }

}

 

Thanks,

Rag

I'm trying to write a simple trigger that renames a record. I keep getting the error "CallLineItemRename: execution of BeforeInsert caused by: System.SObjectException: DML statment cannot operate on trigger.new or trigger.old: Trigger.CallLineItemRename: line 18, column 9" . What am I missing here?

 

 

 

trigger CallLineItemRename on Call_Line_Item__c (before insert, before update) { // this triger renames the call line item id to be // the specified inventory item name or the product name List<Call_Line_Item__c> callItems = new List<Call_Line_Item__c>(); callItems = Trigger.new; for (Call_Line_Item__c callItem : callItems) { //check if inventory or product was specified if (callItem.Inventory_Item__c <> NULL) { callItem.Name = callItem.Inventory_Item__r.Name; callItem.Name = 'inv item name'; } else if (callItem.Products__c <> NULL) { callItem.Name = callItem.Products__r.Name; } } update callItems; }