• RickoT1031
  • NEWBIE
  • 25 Points
  • Member since 2009

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 9
    Questions
  • 16
    Replies

Hello,

 

I need to process e-mails coming from a sharepoint form which of course does not submit both html and plaintext formatting, so I need a way to strip the HTML from the email without loosing the cariage returns of the email itself.   I have been looking thru the forums and the docs but i have not been able to figure it out

 

Any suggestions?

I have updated to spring 10 but I am not able to access content objects (ContentDocument, ContentWorkspaceDoc, ect..) I am not sure why.

 

I just get an error stating that the object type is not supported...

Heya,


So we have a "QuickTicket" page which basically has some of the  things we require on a ticket on one page then the workflow brings us to the ticket edit page after saving.  I wanted to add a search button to search for other tickets with a similiar subject right on the search page. but it does not referesh with the results. I basically took this code from another page I made which just does searches so I know the code works I just dont understand why my page wont refresh... see below for the vf and apex code.

 

Thanks in advance!

 

Ticket Quickstart Apex Code

public with sharing class ITTicketQuickStart { private final Case c; public ITTicketQuickStart(ApexPages.StandardController stdController) { this.c = (Case)stdController.getRecord(); //Set default page values c.Priority = '3 - Normal'; c.Impact__c = 'Individual'; c.Severity__c = 'Request Low'; c.Origin = 'Phone'; } public PageReference save() { String emailaddress = 'servicedesk@g-6e4a7xxymd5g3ajubobvhnda6.in.salesforce.com'; User loggedInUser = [Select firstname,id,contactId,Contact.AccountId,Email from User where id = :UserInfo.getUserId()]; User sdadmin = [select id, name from user where alias = 'SDAdmin']; insert c; Contact vcon = [select id,firstname,name,Accountid,EMail from Contact where id=:c.ContactId]; c.AccountId = vcon.accountid; c.ownerid = loggedinuser.id; Account alookup = [select id, name, Service_Desk__c, TicketsRecordType__c, Email_From_Name__c from Account where id = :c.AccountId]; c.RecordTypeId = alookup.TicketsRecordType__c; c.ERPRequestedBy__c = loggedInUser.Id; Case clookup = [select id, ownerid, contactid, casenumber, Description, Priority, Impact__c, Subject from case where id = :c.id]; Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage(); List<String> toAddresses= new List<String>{vcon.Email}; mail.setToAddresses(toAddresses); String[] BccAddresses = new String[] {loggedInUser.Email}; mail.setBccAddresses(BccAddresses); mail.setReplyTo(emailaddress); mail.setSenderDisplayName(alookup.Email_From_Name__c); mail.setSubject('Ticket (#' + clookup.casenumber + ') Created'); mail.setPlainTextBody(vcon.firstname + ',\n\nYour ticket (#' + clookup.casenumber + ') has been successfully submitted for service. ' + 'A technician will be contacting you shortly.' + '\n\nPriority: ' + clookup.priority + '\nDescription: ' + clookup.description + '\n\nThank you,\n' + Userinfo.getName() + '\n' + alookup.Email_From_Name__c + '\n' + alookup.Service_Desk__c + '\n\nPLEASE DO NOT DELETE ANYTHING BELOW THIS LINE WHEN REPLYING TO THIS E-MAIL.\ncaseid: ' + clookup.id); Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail }); insert new Task(subject = 'Email: ' + mail.getSubject(),Description = mail.getPlainTextBody(),status = 'Completed',IsVisibleInSelfService = True,whatid = c.id,ownerid = sdadmin.id,ActivityDate = utility.DateNow()); return new PageReference('/'+ c.id + '/e?retURL=%2F' + c.id); } public Case CaseResult { get; set; } public List<Case> results {get;set;} public string searchText {get;set{if (value.length() < 3){searchText = '%%';} else {searchText = '%' + value + '%';}}} public PageReference doSearch() { //results.clear(); //if (searchText == '%%'){results= new list<Case>();} else { results = [SELECT Id,CaseNumber,Subject,CreatedById,Priority,Status,Contact.Name,Account.Name,CreatedDate,OwnerId FROM Case where(subject like :searchText)]; return null; } }

 

IT Ticket Quickstart VForce

 

<apex:page standardController="Case" extensions="ITTicketQuickStart"> <style> textarea { width:50%; height:400%; } </style> <style> textbox { width:50%; height:400%; } </style> <apex:sectionHeader title="Create a Ticket" subtitle="All Fields below are required"/> <apex:form > <apex:pageblock > <apex:pageBlockButtons > <apex:commandButton action="{!save}" value="Submit"/> </apex:pageBlockButtons> <apex:PageBlockSection title="Contact Info and Severity/Priority" columns="2" collapsible="false"> <apex:inputField value="{!case.Priority}" Required="True"/> <apex:inputField value="{!case.ContactID}" Required="True" id="ContactName" /> <apex:inputField value="{!case.Severity__c}" Required="True" /> <apex:inputField value="{!case.Origin}" Required="True"/> <apex:inputField value="{!case.Impact__c}" Required="True"/> </apex:PageBlockSection> <apex:PageBlockSection title="Details" columns="1" collapsible="false"> <apex:outputLabel style="padding:0px 5px;font-size:95%;font-weight:bold;font-family: 'Verdana','Geneva',sans-serif;" value="Enter search string to begin" for="searchText" /> <apex:inputText id="searchText" value="{!searchText}" size="50" /> <apex:commandButton value="Search" action="{!doSearch}" rerender="results" status="status" /> <apex:actionStatus id="status" startText="requesting..." /> <apex:inputField value="{!case.Description}" Required="True"/> </apex:PageBlockSection> <apex:pageBlockSection title="Case Search Results" id="results" columns="1" collapsible="false"> <apex:pageBlockTable value="{!results}" var="CaseResult" id="thePBTable"> <apex:column headerValue="Ticket Number"><a href="/{!CaseResult.id}">{!CaseResult.CaseNumber}</a></apex:column> <apex:column headervalue="Status">{!CaseResult.Status}</apex:column>> <apex:column headervalue="Subject">{!CaseResult.Subject}</apex:column> <apex:column headervalue="Priority">{!CaseResult.Priority}</apex:column> <apex:column headervalue="Contact Name">{!CaseResult.Contact.Name}</apex:column> <apex:column headervalue="Date Created">{!CaseResult.CreatedDate}</apex:column> </apex:pageBlockTable> </apex:pageBlockSection> </apex:pageblock> </apex:form> </apex:page>

 

Hello,

 

So i have this nicely laid out HTML document that I am using as a printable form for case infromation. Sometimes they will want to save it as a PDF to the ticket (or to their HDD) but when I generate the PDF document the one page document becomes 2 pages wtih fonts that seem to be almost 50% larger in some places.  How can I make the pdf generate the document wtih the same size as the html doc is generated?  I can post my code if necessary, i just think im missing some extra parameters maybe?

 

Thanks!

~Rick

So, I am trying to start recycling my visual force pages/controllers by passing values in the URL string to determine some of the basic info in my cases instead of having individual pages/controllers for each circumstance.  I have my javascript that reads the URL and I have my controller making the changes on the back end for each circumstance, now I have to connect the two but I am having a bit of a difficult time... any suggestions?

 

VF Javascript Code

 

<SCRIPT LANGUAGE="JavaScript"> var GETDATA = new Array(); var sGet = window.location.search; if (sGet) { sGet = sGet.substr(1); var sNVPairs = sGet.split("&"); for (var i = 0; i < sNVPairs.length; i++) { var sNV = sNVPairs[i].split("="); var sName = sNV[0]; var sValue = sNV[1]; GETDATA[sName] = sValue; } } if (GETDATA["PageConfigName"] != undefined){{!PageConfigName} = GETDATA["PageConfigName"];} </SCRIPT>

 

 

Apex Controller getter/setter code (not complicated lol)

 

 

public String PageConfigName{set;get;}

 

Thanks for your help in advance!!

So I am trying to assign a value to a property in my controller and it just is not working, the value always ends up as null... am I doing somethign wrong?

 

In My Controller

public Boolean blnDoAttachment{get; set;}

 

 <<Some Code>>

 

 if (blnDoAttachment == True){

return new PageReference('p/attach/NoteAttach?pid=/' + c.id + 'retURL=' + c.id); 

 

}

if (blnDoAttachment == False){

return new PageReference('/'+ c.id);

}

return null;

 

On My VisualForce Page

<apex:commandButton action="{!save}" value="Submit"><apex:param value="False" assignto="{!blnDoAttachment}"/></apex:commandButton> <apex:commandButton action="{!save}" value="Submit and Attach"><apex:param value="True" assignto="{!blnDoAttachment}"/></apex:commandButton>

Any assistance would be greatly appreciated.  I am pretty sure its just something totally stupid on my part

 

Thanks!

 

Message Edited by RickoT1031 on 03-09-2010 04:27 PM

Hey all, so my goal here is if they are redirected to this custom visual force page and certian ticket information is not present it redirects them to the edit page to add the apropriate information, however I cannot get the visual force page to see my functions when editing the java (see below)

 

Visual Force Page:

 


<apex:page standardcontroller="Case" extensions="EscalateTicket">

<apex:sectionHeader title="Change Status" subtitle="Please select the new status below"/>

<style>

textarea { width:50%; height:120%; }

</style>

<script>

window.onload = CheckCategories;

function CheckCategories() {

if ({!CheckCats()} == false)

{

alert ("Categorization Information not entered, Skipping to edit");document.location =

"{!GoToEdit}" }

}

</script> <apex:form >

<apex:pageblock >

<apex:pageBlockSection title="Escalation Selection" columns="1">

<apex:selectList value="{!NewAssignment}" multiselect="False" Required="True">

 <apex:selectOptions value="{!Groups}"/>

</apex:selectList>

<apex:inputField value="{!case.Escalation_Comments__c}" Required="True"/>

 </apex:pageBlockSection>

</apex:pageblock><

apex:commandButton action="{!Save}" value="Escalate Ticket"/>

</apex:form>

 

</apex:page>


The error message I get is "Unknown Function CheckCats Check Spelling"

 

The apex methods in question are below

 

Apex Class


public class EscalateTicket {

private final Case c;

public EscalateTicket(ApexPages.StandardController stdController) { this.c = (Case)stdController.getRecord();

}

 

public Boolean CheckCats(){

if ((c.type == '') || (c.Sub_Category__c =='' ) || (c.reason == '')) {return False;} return true;

}

 

public PageReference GoToEdit(){return new PageReference('/' + c.id + '/e?retURL=%2F' + c.id);}

 

}

So I am writing a small vb app and what I would like to do is have a link to a ticket, or contact, or whatever that opens whatever the resource is.  The problem is that I have to log in when I do this.  How can I pass the session info in the link im clicking on in order to prevent having to log in via my web browser?

Hello,


I have written a small visual force function to query the tickets open in each one of our clients, however What I would like to do next is have the results as links to each box (including the analyst) anyone know of an easy way to do this?  I can post my source if necessary

 

Thanks!

Hello,

 

I need to process e-mails coming from a sharepoint form which of course does not submit both html and plaintext formatting, so I need a way to strip the HTML from the email without loosing the cariage returns of the email itself.   I have been looking thru the forums and the docs but i have not been able to figure it out

 

Any suggestions?

I have updated to spring 10 but I am not able to access content objects (ContentDocument, ContentWorkspaceDoc, ect..) I am not sure why.

 

I just get an error stating that the object type is not supported...

Heya,


So we have a "QuickTicket" page which basically has some of the  things we require on a ticket on one page then the workflow brings us to the ticket edit page after saving.  I wanted to add a search button to search for other tickets with a similiar subject right on the search page. but it does not referesh with the results. I basically took this code from another page I made which just does searches so I know the code works I just dont understand why my page wont refresh... see below for the vf and apex code.

 

Thanks in advance!

 

Ticket Quickstart Apex Code

public with sharing class ITTicketQuickStart { private final Case c; public ITTicketQuickStart(ApexPages.StandardController stdController) { this.c = (Case)stdController.getRecord(); //Set default page values c.Priority = '3 - Normal'; c.Impact__c = 'Individual'; c.Severity__c = 'Request Low'; c.Origin = 'Phone'; } public PageReference save() { String emailaddress = 'servicedesk@g-6e4a7xxymd5g3ajubobvhnda6.in.salesforce.com'; User loggedInUser = [Select firstname,id,contactId,Contact.AccountId,Email from User where id = :UserInfo.getUserId()]; User sdadmin = [select id, name from user where alias = 'SDAdmin']; insert c; Contact vcon = [select id,firstname,name,Accountid,EMail from Contact where id=:c.ContactId]; c.AccountId = vcon.accountid; c.ownerid = loggedinuser.id; Account alookup = [select id, name, Service_Desk__c, TicketsRecordType__c, Email_From_Name__c from Account where id = :c.AccountId]; c.RecordTypeId = alookup.TicketsRecordType__c; c.ERPRequestedBy__c = loggedInUser.Id; Case clookup = [select id, ownerid, contactid, casenumber, Description, Priority, Impact__c, Subject from case where id = :c.id]; Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage(); List<String> toAddresses= new List<String>{vcon.Email}; mail.setToAddresses(toAddresses); String[] BccAddresses = new String[] {loggedInUser.Email}; mail.setBccAddresses(BccAddresses); mail.setReplyTo(emailaddress); mail.setSenderDisplayName(alookup.Email_From_Name__c); mail.setSubject('Ticket (#' + clookup.casenumber + ') Created'); mail.setPlainTextBody(vcon.firstname + ',\n\nYour ticket (#' + clookup.casenumber + ') has been successfully submitted for service. ' + 'A technician will be contacting you shortly.' + '\n\nPriority: ' + clookup.priority + '\nDescription: ' + clookup.description + '\n\nThank you,\n' + Userinfo.getName() + '\n' + alookup.Email_From_Name__c + '\n' + alookup.Service_Desk__c + '\n\nPLEASE DO NOT DELETE ANYTHING BELOW THIS LINE WHEN REPLYING TO THIS E-MAIL.\ncaseid: ' + clookup.id); Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail }); insert new Task(subject = 'Email: ' + mail.getSubject(),Description = mail.getPlainTextBody(),status = 'Completed',IsVisibleInSelfService = True,whatid = c.id,ownerid = sdadmin.id,ActivityDate = utility.DateNow()); return new PageReference('/'+ c.id + '/e?retURL=%2F' + c.id); } public Case CaseResult { get; set; } public List<Case> results {get;set;} public string searchText {get;set{if (value.length() < 3){searchText = '%%';} else {searchText = '%' + value + '%';}}} public PageReference doSearch() { //results.clear(); //if (searchText == '%%'){results= new list<Case>();} else { results = [SELECT Id,CaseNumber,Subject,CreatedById,Priority,Status,Contact.Name,Account.Name,CreatedDate,OwnerId FROM Case where(subject like :searchText)]; return null; } }

 

IT Ticket Quickstart VForce

 

<apex:page standardController="Case" extensions="ITTicketQuickStart"> <style> textarea { width:50%; height:400%; } </style> <style> textbox { width:50%; height:400%; } </style> <apex:sectionHeader title="Create a Ticket" subtitle="All Fields below are required"/> <apex:form > <apex:pageblock > <apex:pageBlockButtons > <apex:commandButton action="{!save}" value="Submit"/> </apex:pageBlockButtons> <apex:PageBlockSection title="Contact Info and Severity/Priority" columns="2" collapsible="false"> <apex:inputField value="{!case.Priority}" Required="True"/> <apex:inputField value="{!case.ContactID}" Required="True" id="ContactName" /> <apex:inputField value="{!case.Severity__c}" Required="True" /> <apex:inputField value="{!case.Origin}" Required="True"/> <apex:inputField value="{!case.Impact__c}" Required="True"/> </apex:PageBlockSection> <apex:PageBlockSection title="Details" columns="1" collapsible="false"> <apex:outputLabel style="padding:0px 5px;font-size:95%;font-weight:bold;font-family: 'Verdana','Geneva',sans-serif;" value="Enter search string to begin" for="searchText" /> <apex:inputText id="searchText" value="{!searchText}" size="50" /> <apex:commandButton value="Search" action="{!doSearch}" rerender="results" status="status" /> <apex:actionStatus id="status" startText="requesting..." /> <apex:inputField value="{!case.Description}" Required="True"/> </apex:PageBlockSection> <apex:pageBlockSection title="Case Search Results" id="results" columns="1" collapsible="false"> <apex:pageBlockTable value="{!results}" var="CaseResult" id="thePBTable"> <apex:column headerValue="Ticket Number"><a href="/{!CaseResult.id}">{!CaseResult.CaseNumber}</a></apex:column> <apex:column headervalue="Status">{!CaseResult.Status}</apex:column>> <apex:column headervalue="Subject">{!CaseResult.Subject}</apex:column> <apex:column headervalue="Priority">{!CaseResult.Priority}</apex:column> <apex:column headervalue="Contact Name">{!CaseResult.Contact.Name}</apex:column> <apex:column headervalue="Date Created">{!CaseResult.CreatedDate}</apex:column> </apex:pageBlockTable> </apex:pageBlockSection> </apex:pageblock> </apex:form> </apex:page>

 

Hello,

 

So i have this nicely laid out HTML document that I am using as a printable form for case infromation. Sometimes they will want to save it as a PDF to the ticket (or to their HDD) but when I generate the PDF document the one page document becomes 2 pages wtih fonts that seem to be almost 50% larger in some places.  How can I make the pdf generate the document wtih the same size as the html doc is generated?  I can post my code if necessary, i just think im missing some extra parameters maybe?

 

Thanks!

~Rick

So, I am trying to start recycling my visual force pages/controllers by passing values in the URL string to determine some of the basic info in my cases instead of having individual pages/controllers for each circumstance.  I have my javascript that reads the URL and I have my controller making the changes on the back end for each circumstance, now I have to connect the two but I am having a bit of a difficult time... any suggestions?

 

VF Javascript Code

 

<SCRIPT LANGUAGE="JavaScript"> var GETDATA = new Array(); var sGet = window.location.search; if (sGet) { sGet = sGet.substr(1); var sNVPairs = sGet.split("&"); for (var i = 0; i < sNVPairs.length; i++) { var sNV = sNVPairs[i].split("="); var sName = sNV[0]; var sValue = sNV[1]; GETDATA[sName] = sValue; } } if (GETDATA["PageConfigName"] != undefined){{!PageConfigName} = GETDATA["PageConfigName"];} </SCRIPT>

 

 

Apex Controller getter/setter code (not complicated lol)

 

 

public String PageConfigName{set;get;}

 

Thanks for your help in advance!!

So I am trying to assign a value to a property in my controller and it just is not working, the value always ends up as null... am I doing somethign wrong?

 

In My Controller

public Boolean blnDoAttachment{get; set;}

 

 <<Some Code>>

 

 if (blnDoAttachment == True){

return new PageReference('p/attach/NoteAttach?pid=/' + c.id + 'retURL=' + c.id); 

 

}

if (blnDoAttachment == False){

return new PageReference('/'+ c.id);

}

return null;

 

On My VisualForce Page

<apex:commandButton action="{!save}" value="Submit"><apex:param value="False" assignto="{!blnDoAttachment}"/></apex:commandButton> <apex:commandButton action="{!save}" value="Submit and Attach"><apex:param value="True" assignto="{!blnDoAttachment}"/></apex:commandButton>

Any assistance would be greatly appreciated.  I am pretty sure its just something totally stupid on my part

 

Thanks!

 

Message Edited by RickoT1031 on 03-09-2010 04:27 PM

Hey all, so my goal here is if they are redirected to this custom visual force page and certian ticket information is not present it redirects them to the edit page to add the apropriate information, however I cannot get the visual force page to see my functions when editing the java (see below)

 

Visual Force Page:

 


<apex:page standardcontroller="Case" extensions="EscalateTicket">

<apex:sectionHeader title="Change Status" subtitle="Please select the new status below"/>

<style>

textarea { width:50%; height:120%; }

</style>

<script>

window.onload = CheckCategories;

function CheckCategories() {

if ({!CheckCats()} == false)

{

alert ("Categorization Information not entered, Skipping to edit");document.location =

"{!GoToEdit}" }

}

</script> <apex:form >

<apex:pageblock >

<apex:pageBlockSection title="Escalation Selection" columns="1">

<apex:selectList value="{!NewAssignment}" multiselect="False" Required="True">

 <apex:selectOptions value="{!Groups}"/>

</apex:selectList>

<apex:inputField value="{!case.Escalation_Comments__c}" Required="True"/>

 </apex:pageBlockSection>

</apex:pageblock><

apex:commandButton action="{!Save}" value="Escalate Ticket"/>

</apex:form>

 

</apex:page>


The error message I get is "Unknown Function CheckCats Check Spelling"

 

The apex methods in question are below

 

Apex Class


public class EscalateTicket {

private final Case c;

public EscalateTicket(ApexPages.StandardController stdController) { this.c = (Case)stdController.getRecord();

}

 

public Boolean CheckCats(){

if ((c.type == '') || (c.Sub_Category__c =='' ) || (c.reason == '')) {return False;} return true;

}

 

public PageReference GoToEdit(){return new PageReference('/' + c.id + '/e?retURL=%2F' + c.id);}

 

}

So I am writing a small vb app and what I would like to do is have a link to a ticket, or contact, or whatever that opens whatever the resource is.  The problem is that I have to log in when I do this.  How can I pass the session info in the link im clicking on in order to prevent having to log in via my web browser?

Hello,


I have written a small visual force function to query the tickets open in each one of our clients, however What I would like to do next is have the results as links to each box (including the analyst) anyone know of an easy way to do this?  I can post my source if necessary

 

Thanks!