• Jared Kremer
  • NEWBIE
  • 30 Points
  • Member since 2013

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

I want to populate the Systemdate(i.e Day date) in the current_Date_sys date field if my checkbox  sys_check is checked.

 

and if it's  unchecked then i  want to make the current_Date_sys field blank.

 

Can anyone guide me on this formula?

 

Hello, 

 

So I have an interesting issue. Im trying to get an image from a <input type="file" /> and not an <apex:input />. Reasons behind this is a front end framework that lives on top of the platform and that we are not using controllers and pages as the controller -> page model. 

 

What I have thus far is 

 

getImage: function(options) {
			if (document.getElementById("Vendor_Image__c").files.length === 0) {
				return;
			}
			oFReader = new FileReader();
			rFilter = /^(?:image\/bmp|image\/cis\-cod|image\/gif|image\/ief|image\/jpeg|image\/jpeg|image\/jpeg|image\/pipeg|image\/png|image\/svg\+xml|image\/tiff|image\/x\-cmu\-raster|image\/x\-cmx|image\/x\-icon|image\/x\-portable\-anymap|image\/x\-portable\-bitmap|image\/x\-portable\-graymap|image\/x\-portable\-pixmap|image\/x\-rgb|image\/x\-xbitmap|image\/x\-xpixmap|image\/x\-xwindowdump)$/i;
			var that = this;
			var oFile = document.getElementById("Vendor_Image__c").files[0];
			if (!rFilter.test(oFile.type)) {
				flashMessage({
					message: 'The File type you are trying to add for the image is not supported.'
				});
				return;
			}
			oFReader.onload = function(oFREvent) {
				$("#vendor-image").html('<image src="' + oFREvent.target.result + '" alt="No Preview" />');

				oFReader.onload = function(oFREvent) {
					that.model.set({
						_Vendor_Image__c: oFREvent.target.result
					});
				}
				oFReader.readAsBinaryString(oFile);
			};


			oFReader.readAsDataURL(oFile);
		},

 

 

This does a great job handling the front end UI but the backend is different. 

 

Using Apex Remove Actions:

I have made 2 attempts, 1 being that I have tried a rich text field and putting the base64 inside of it. But I easily break the max character count even though 1MB pictures are allowed. 

 

Likewise, the second approach I run into Visualforce Remoting Error "input to long":

 

Visualforce Remoting Exception: Input too long. [0, 1000000] 

 But I can fit smaller images in such as around a 200KB file, but my attempts at a 900KB file fails. Have tried as a Blob and String to send the data to a remote action to create a SF attachment instead of a rich text field. 

 

Any ideas for how I could keep this in JS and get the data back into SF? 

 

Thanks in Advance! 

I want to populate the Systemdate(i.e Day date) in the current_Date_sys date field if my checkbox  sys_check is checked.

 

and if it's  unchecked then i  want to make the current_Date_sys field blank.

 

Can anyone guide me on this formula?

 

I am writing a trigger to copy values in 5 different picklists, lookup the cooresponding user records, and past the ids in 8 cooresponding user ids in the appropriate lookup fields on the account page. At this time I am using 8 different lists to capture the different userids. Below is my code:

trigger SetPCNApprovers on PCN_s__c (Before Insert, Before Update) {

    Set<Id> pId = new Set<Id>();
    string scheduling;
    string OE;
    string redmondeng;
    string shipping;
    string peng;
    string estimating;
    string techw;
    string accounting;
    
    For(PCN_s__c pcn : trigger.new){
     pId.add(pcn.id);
     scheduling = pcn.scheduling__c;
     System.debug('**** 1 scheduling id : '+ pcn.scheduling__c);
     oe = pcn.Order_entry__c;
     redmondeng = pcn.Redmond_ENG__c;
     shipping = pcn.shipping__c;
     peng = pcn.Project_Engineering__c;
     estimating = pcn.estimating__c;
     techw = pcn.tech_writing__c;
     accounting = pcn.A_R_Acctg__c;

    }
                
    List<user> usched = new List<user>([select id, name__c from user where name__c =: scheduling]);                

    List<user> uoe = new List<user>([select id, name__c from user where name__c =: oe]);

    List<user> ured= new List<user>([select id, name__c from user where name__c =: redmondeng]);

    List<user> uship = new List<user>([select id, name__c from user where name__c =: shipping]);

    List<user> upeng = new List<user>([select id, name__c from user where name__c =: peng]);

    List<user> uest = new List<user>([select id, name__c from user where name__c =: estimating]);

    List<user> utechw = new List<user>([select id, name__c from user where name__c =: techw]);
    
    List<user> uaccounting = new List<user>([select id, name__c from user where name__c =: accounting]);

    For(PCN_s__c upcn : trigger.new){
        If(usched.size()>0){
            upcn.Scheduling_User_Lookup__c = usched[0].id;
        }
        If(uoe.size()>0){
            upcn.Order_Entry_Lookup__c = uoe[0].id;
        }
        If(ured.size()>0){
            upcn.Redmond_Engineer_Lookup__c = ured[0].id;
        }
        If(uship.size()>0){
            upcn.Shipping_Lookup__c = uship[0].id;
        }
        If(upeng.size()>0){
            upcn.Project_Engineering_Lookup__c = upeng[0].id;
        }
        If(uest.size()>0){
            upcn.Estimating_Lookup__c = uest[0].id;
        }
        If(utechw.size()>0){
            upcn.Tech_Writing_Lookup__c = utechw[0].id;
        }
        If(uaccounting.size()>0){
            upcn.Accounting_Lookup__c = uaccounting[0].id;
        }
   
    }
}

 How do I write a better trigger?

 

Thanks,

I'm trying to change my domain name mydomain.force.com to mydomain.com 

 

I've read http://www.adnsandbox.com/df08/sites_using_custom_domain.pdf but the issue I'm having is creating those CNAME records on Go Daddy.

 

On Godaddy I have the option to change the A (Host) record from @ to an IP address which from reading articles on their site is what I would need to do but instead of an IP address I think I need to have it say mydomain.force.com but it'll only let me put an IP address in.

 

If anyone has experience with this or might be able to offer suggestions I'd highly appreciate it. Currently I'm forwarding mydomain.com to mydomain.force.com and this in turn I believe has resulted in my site not being searchable on Google anymore because I do not have the custom domain configured (my site has been running for about 3 months now).

 

Thanks!

  • December 04, 2010
  • Like
  • 0