• Debbie61
  • NEWBIE
  • 150 Points
  • Member since 2010

  • Chatter
    Feed
  • 6
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 13
    Questions
  • 20
    Replies

We have a VF page and tab designed to take the SFC to an external website. The reason we used a VF page instead of a Web Tab is because we have to submit a form with  hidden input fields to store the userid and password and some other parameters as a Post to the website to have the user automatically logged in.

 

I would like this page to work similar to a Web tab. Where the user would click on the tab and our external website shows up within the SFC tab. I can't figure out how to do this. Presently, my only option is to have the tab create a new browser window for the user.

I am trying to use the upsert command for uploading documents but I am not understanding what I am suppose to pass to SFC api for the External ID of the document array?

 

I have tried "DocumentId" and I have tried "Document_ID" and both throw this error:

"SoapException: INVALID_FIELD: Field name provided, Document_ID does not match an External ID for Document"

 

Here is my code:

sforce.UpsertResult[] sfcResults = binding.upsert("Document_ID", docsToUpload);

 

 

 

I modelled this upsert call after one that is working for another custom object. I have a log entry right before the upsert call and a log entry right after the upsert call to capture the size of the upsertResults. I have the upsert call within a try catch block. I see the log entry before the call. I do not see any other log entries until after the try catch. I see no log entries for any exceptions being thrown. Need some help figuring out what I have missed here. And I have verified that my updateArray contains at least of length 1

 

try
            {
                logger.Debug("Preparing to try the upsert");
                UpsertResult[] upsertResults = binding.upsert("Request_ID__c", updateArray);
                logger.Debug("length of upsertResults " + upsertResults.Length);
                for (int i = 0; i < upsertResults.Length; i++)
                {
                    if (upsertResults[i].success)
                    {
                        setMDC(Convert.ToString(updateArray[i].project_task_id__c), updateArray[i].Request_ID__c, updateArray[i].Store_Number__c);
                        logger.Info("DmbInstall updated for id: " + upsertResults[i].id);
                        clearMDC();
                        localm4TableAdapters.dmb_Load_Sales_ForceTableAdapter ad = new SalesForceWebServices.localm4TableAdapters.dmb_Load_Sales_ForceTableAdapter();
                        int nNoUpdate = -1;
                        nNoUpdate = ad.updSFCUpdatedFlag(dateStamp, updateArray[i].Request_ID__c, Convert.ToInt32(updateArray[i].project_task_id__c));
                        successCount = successCount + 1;

                    }
                    else
                    {
                        setMDC(Convert.ToString(updateArray[i].project_task_id__c), updateArray[i].Request_ID__c, updateArray[i].Store_Number__c);
                        logger.Error("DmbInstall update failed for id: " + upsertResults[i].id);
                        clearMDC();
                        foreach (Error error in upsertResults[i].errors)
                        {
                            logger.Error("ERROR Code: " + error.statusCode.ToString() + " " + Convert.ToInt32(updateArray[i].project_task_id__c));
                            logger.Error("ERROR Message: " + error.message);
                        }
                    }
                }
            }
            catch (SoapException ex)
            {
                logger.Error("Failed to execute query succesfully," +
                       "error message was: " + ex.Message);
            }
            catch (Exception e)
            {
                logger.Error("Fail upsert" + e.Message);
            }
            logger.Info("Successfully loaded " + successCount + " Updated Install Records");

 

I am trying to write a trigger that will check to see if an xls spreadsheet attachment has been uploaded for a custom object. In the API,  Attachments are of type="tns:QueryResult". But when I deploy my trigger to Salesforce, I get an error back that says:  Problem: Invalid type: QueryResult

 

Here is the code:

trigger dmbSurveyContainsSpreadsheet on dmb_survey__c (after update) {	
	 
    for(dmb_survey__c obj : Trigger.new) 
    { 
    	Boolean contains = false;
    	if (obj.Status_Setting__c == 'Complete')
    	{
    		QueryResult qr = obj.Attachments;
    		if (qr != null)
    		{
    			for (int i = 0; i < qr.records.Length; i++) 
    			{
    			   Attachment attach = (Attachment)attachQR.records[i]; 
    			   string contentType = attach.ContentType;
                              contains = contentType.Contains('ms-excel');
                              if (contains)
                              {
                                  break;
                               }    				    	
    			}
    		}
    		if (!contains)
    		{    		
    			obj.Contains_Spreadsheet__c = 1;
    		}    		    		
    	}    	
    }
}

 

 

 

Could somebody please tell me what I am doing wrong? Thank you!

According to the SFC documentation, if I designate a field in my custom object as an external id ( which I did), and then set the value of the field in the webservice (which I did), that SFC will perform the udpate using the foreign key instead of a SFC Id ( this did not happen).

 

I have a custom object called : dmb_survey__c

I checked field for external id: project_task_id__c

I set the field value in my web service code :

dmb.project_task_id__c = row.task_id;

I call the SFC update :

SaveResult[] saveResults = binding.update(updateArray);  

 

SFC returns the following error message:

"ERROR Message: Id not specified in an update call"

Well, its not specified because SFC claims you do not need it if you have a foreign key. What am I missing here?

According to SFC documentation "values can be a primitive". An Integer is a primitive.

 

I am building a trigger that requires me to do a check on how many Circuits have already been defined. If the user is defining the first circuit, all fields are required. I had the count in a for loop and it works fine until I break the bulk trigger rules with Too many SOQL queries

 

Integer mycount  = [select count() from Circuit__c where Device__c = :circ.Device__c];

 

So I thought I would put the count in a Map and correlate it to an Id.

 

Map<Id, Integer> circCountMap = new Map<Id, Integer>
   ([SELECT count() FROM Circuit__c WHERE Device__c in:devIds]);

 

But when I try to save, I get an error

Error: Compile Error: Invalid initial type Integer for MAP:Id,String at line 13 column 35 

 

Why can't I do this? And does anybody have a suggestion for how I can get the counts so I can check each Circuit being inserted?

 

Thank you

This error doesn't make any sense. The only way that I can include a custom field in the

object's searchResultsField is thru the SFC interface from the object. ( at least as far as

i know...)

 

The field that SFC is referencing in my deploy error message is in the list of fields available

to add to to search results. How else could I have added it?

 

I double checked the object. The field is there. It's not a case of where I added a field,

modified the searchResults and then deleted the field.

 

 

Any thoughts on this error would be appreciated. I received five other errors just like this

one on other custom objects I was trying to deploy to production.

 

 

 

 

I am at 63% for testing my class and the piece SFC is hi-lighting as not being tested is the section that catches a query exception and creates ApexPages.Message

 

 

catch (QueryException qe) { ApexPages.Message myMsg = new ApexPages.Message (ApexPages.severity.ERROR, 'Error retrieving login username'); ApexPages.addMessage(myMsg); return null; }

 

I am not sure why SFC does not think I am testing as my test method looks like this:

 

 

static testMethod void throwQE() { try{ ...some code here... } catch (QueryException qe) { ApexPages.Message myMsg = new ApexPages.Message (ApexPages.severity.ERROR, 'Error retrieving login username'); ApexPages.addMessage(myMsg); System.assert(true); }

 

I did verify that a query exception is being thrown.

 

Any thoughts? Appreciate the help.

Message Edited by Debbie61 on 03-31-2010 02:43 PM

I am scratching my head silly over this one. I am getting errors stating that I am missing the following two end tags

</apex:page> </apex:pageBlockSection>

 


Problem is that I am not missing them. They are in my code. Can somebody please look at this and maybe find what my real problem is? Here is all the code for this page

 

<apex:page Controller="SecurityDAO"> <script type="text/javascript"> function adios () { var username = {!Security.SW_Username__c}; if ( username != null ){ var myform = document.getElementById("form1"); var a = document.getElement myform.submit(); } else { alert("Error"); } window.onload = adios; </script> <apex:messages styleClass="exceptionText"/> <apex:pageBlockSection rendered="{!Security.SW_Username__c != null}"> <h1>Welcome {!$User.FirstName} {!$User.LastName} to the Winds Logon Page</h1><p></p> Clicking on the tab should open a new browser window and log you in to</br> Winds. Your browser must allow pop-ups for this to occur. You can also</br> log in to Winds by clicking the button below. <form id="form1" method="post" action="https://{!Security.SW_URL__c}/data/Login.aspx?ReturnUrl=%2fDefault.aspx" target="_blank"> <input TYPE="hidden" name="ctl00$ContentPlaceHolder1$Username" value="{!Security.SW_Username__c}"/> <input TYPE="hidden" name="ctl00$ContentPlaceHolder1$Password" value="{!Security.SW_Password__c}" /> <input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="" /> <input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" /> <br /> <input type="submit" value="Winds Login" /><br /> </form> </apex:pageBlockSection> </apex:page>

 

 

Appreciate any help I can get. Thanks.

Logically, I want to say:

 

IF status = 'Onboard' && ( startDate is Null || endDate is Null ) Then error out the record.

Or in other words, both date fields must be populated if status = 'Onboard'.

 

Now taking that and getting the right validation logic has caused me problems. Whatever code I have used, I have

either got a situation where both dates are populated and it still won't let me save, or it lets me save if none of the

dates are there.

 

This was the last one I tried.

AND( OR( CONTAINS(TEXT(Site__r.Status__c),"Onboard"), AND ( NOT(ISNULL( MACD_Start_Date__c )) , NOT(ISNULL( MACD_End_Date__c )) ) ))

 

Thanks for any help.

I built a custom object using User as a lookup. I tested my code as a normal

user in sfc.com and my code was able to find the match for my userid.

 

But when I setup the customer portal and test the code, I don't get an error

but I don't get any results back from getUserId() either.

 

myUserId = UserInfo.getUserId(); Ticket__c ticket = [select User__c, m4_ticket__c, M4_site__c, User__r.FirstName, User__r.LastName from Ticket__c where User__c = :myUserId LIMIT 1];

 

I have checked the Portal Profile and the Profile does have Read access to the Ticket object.

 

The VisualForce page I created is able to distinguish the Portal User in a greeting using

{!$User.Username}

 

 

 

I checked my customer portal's profile and my new VF tab

is included in the profile and is set to "Default On".

 

When I log in to the portal as the user, I cannot see the tab.

 

Can somebody please tell me what steps I may have missed?

 

Thanks

I need to create a report that will be run daily by user community. It needs to filter on a Date field

but I only want to display what occurred in the last 24 hours.

In Oracle I would do "datefield >= sysdate - 1".

 

How do I do this in SalesForce tool?

 

Thanks

We have a VF page and tab designed to take the SFC to an external website. The reason we used a VF page instead of a Web Tab is because we have to submit a form with  hidden input fields to store the userid and password and some other parameters as a Post to the website to have the user automatically logged in.

 

I would like this page to work similar to a Web tab. Where the user would click on the tab and our external website shows up within the SFC tab. I can't figure out how to do this. Presently, my only option is to have the tab create a new browser window for the user.

I am trying to use the upsert command for uploading documents but I am not understanding what I am suppose to pass to SFC api for the External ID of the document array?

 

I have tried "DocumentId" and I have tried "Document_ID" and both throw this error:

"SoapException: INVALID_FIELD: Field name provided, Document_ID does not match an External ID for Document"

 

Here is my code:

sforce.UpsertResult[] sfcResults = binding.upsert("Document_ID", docsToUpload);

 

 

 

I am trying to write a trigger that will check to see if an xls spreadsheet attachment has been uploaded for a custom object. In the API,  Attachments are of type="tns:QueryResult". But when I deploy my trigger to Salesforce, I get an error back that says:  Problem: Invalid type: QueryResult

 

Here is the code:

trigger dmbSurveyContainsSpreadsheet on dmb_survey__c (after update) {	
	 
    for(dmb_survey__c obj : Trigger.new) 
    { 
    	Boolean contains = false;
    	if (obj.Status_Setting__c == 'Complete')
    	{
    		QueryResult qr = obj.Attachments;
    		if (qr != null)
    		{
    			for (int i = 0; i < qr.records.Length; i++) 
    			{
    			   Attachment attach = (Attachment)attachQR.records[i]; 
    			   string contentType = attach.ContentType;
                              contains = contentType.Contains('ms-excel');
                              if (contains)
                              {
                                  break;
                               }    				    	
    			}
    		}
    		if (!contains)
    		{    		
    			obj.Contains_Spreadsheet__c = 1;
    		}    		    		
    	}    	
    }
}

 

 

 

Could somebody please tell me what I am doing wrong? Thank you!

According to the SFC documentation, if I designate a field in my custom object as an external id ( which I did), and then set the value of the field in the webservice (which I did), that SFC will perform the udpate using the foreign key instead of a SFC Id ( this did not happen).

 

I have a custom object called : dmb_survey__c

I checked field for external id: project_task_id__c

I set the field value in my web service code :

dmb.project_task_id__c = row.task_id;

I call the SFC update :

SaveResult[] saveResults = binding.update(updateArray);  

 

SFC returns the following error message:

"ERROR Message: Id not specified in an update call"

Well, its not specified because SFC claims you do not need it if you have a foreign key. What am I missing here?

According to SFC documentation "values can be a primitive". An Integer is a primitive.

 

I am building a trigger that requires me to do a check on how many Circuits have already been defined. If the user is defining the first circuit, all fields are required. I had the count in a for loop and it works fine until I break the bulk trigger rules with Too many SOQL queries

 

Integer mycount  = [select count() from Circuit__c where Device__c = :circ.Device__c];

 

So I thought I would put the count in a Map and correlate it to an Id.

 

Map<Id, Integer> circCountMap = new Map<Id, Integer>
   ([SELECT count() FROM Circuit__c WHERE Device__c in:devIds]);

 

But when I try to save, I get an error

Error: Compile Error: Invalid initial type Integer for MAP:Id,String at line 13 column 35 

 

Why can't I do this? And does anybody have a suggestion for how I can get the counts so I can check each Circuit being inserted?

 

Thank you

This error doesn't make any sense. The only way that I can include a custom field in the

object's searchResultsField is thru the SFC interface from the object. ( at least as far as

i know...)

 

The field that SFC is referencing in my deploy error message is in the list of fields available

to add to to search results. How else could I have added it?

 

I double checked the object. The field is there. It's not a case of where I added a field,

modified the searchResults and then deleted the field.

 

 

Any thoughts on this error would be appreciated. I received five other errors just like this

one on other custom objects I was trying to deploy to production.

 

 

 

 

I am at 63% for testing my class and the piece SFC is hi-lighting as not being tested is the section that catches a query exception and creates ApexPages.Message

 

 

catch (QueryException qe) { ApexPages.Message myMsg = new ApexPages.Message (ApexPages.severity.ERROR, 'Error retrieving login username'); ApexPages.addMessage(myMsg); return null; }

 

I am not sure why SFC does not think I am testing as my test method looks like this:

 

 

static testMethod void throwQE() { try{ ...some code here... } catch (QueryException qe) { ApexPages.Message myMsg = new ApexPages.Message (ApexPages.severity.ERROR, 'Error retrieving login username'); ApexPages.addMessage(myMsg); System.assert(true); }

 

I did verify that a query exception is being thrown.

 

Any thoughts? Appreciate the help.

Message Edited by Debbie61 on 03-31-2010 02:43 PM

I am scratching my head silly over this one. I am getting errors stating that I am missing the following two end tags

</apex:page> </apex:pageBlockSection>

 


Problem is that I am not missing them. They are in my code. Can somebody please look at this and maybe find what my real problem is? Here is all the code for this page

 

<apex:page Controller="SecurityDAO"> <script type="text/javascript"> function adios () { var username = {!Security.SW_Username__c}; if ( username != null ){ var myform = document.getElementById("form1"); var a = document.getElement myform.submit(); } else { alert("Error"); } window.onload = adios; </script> <apex:messages styleClass="exceptionText"/> <apex:pageBlockSection rendered="{!Security.SW_Username__c != null}"> <h1>Welcome {!$User.FirstName} {!$User.LastName} to the Winds Logon Page</h1><p></p> Clicking on the tab should open a new browser window and log you in to</br> Winds. Your browser must allow pop-ups for this to occur. You can also</br> log in to Winds by clicking the button below. <form id="form1" method="post" action="https://{!Security.SW_URL__c}/data/Login.aspx?ReturnUrl=%2fDefault.aspx" target="_blank"> <input TYPE="hidden" name="ctl00$ContentPlaceHolder1$Username" value="{!Security.SW_Username__c}"/> <input TYPE="hidden" name="ctl00$ContentPlaceHolder1$Password" value="{!Security.SW_Password__c}" /> <input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="" /> <input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" /> <br /> <input type="submit" value="Winds Login" /><br /> </form> </apex:pageBlockSection> </apex:page>

 

 

Appreciate any help I can get. Thanks.

I built a custom object using User as a lookup. I tested my code as a normal

user in sfc.com and my code was able to find the match for my userid.

 

But when I setup the customer portal and test the code, I don't get an error

but I don't get any results back from getUserId() either.

 

myUserId = UserInfo.getUserId(); Ticket__c ticket = [select User__c, m4_ticket__c, M4_site__c, User__r.FirstName, User__r.LastName from Ticket__c where User__c = :myUserId LIMIT 1];

 

I have checked the Portal Profile and the Profile does have Read access to the Ticket object.

 

The VisualForce page I created is able to distinguish the Portal User in a greeting using

{!$User.Username}

 

 

 

I checked my customer portal's profile and my new VF tab

is included in the profile and is set to "Default On".

 

When I log in to the portal as the user, I cannot see the tab.

 

Can somebody please tell me what steps I may have missed?

 

Thanks