• bakul.patel
  • NEWBIE
  • 10 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 12
    Questions
  • 24
    Replies
HI,
I am facing a strange problem. We have a Vendor_Vendor__c field in Product2 object which is lookup to Vendor object. When I am using that field in a tirgger, it complains that "Vendor_Vendor__c field not found in Product2 object" but I can clearly see that field being there. So, I tried to delete that field from Product2 object, but at that time it complained that it is being used in the same trigger.

It seems to be a case of oxymoron. Has anybody faced such problem earlier?
 I have following code in a REST service exposed through Force.com site
 
Case c = new Case (AccountId = '0019E000002pKMCQA2', description='est mgsg', Origin='Phone', Status='New');
insert c;

When I call this REST service from hurl.it, it works fine and creates case.
When I call this same REST service from different program, it fails. I get error Insert failed. First exception on row 0; first error: UNKNOWN_EXCEPTION, invalid parameter value: []

Pleaes note that all the field values are hard coded, so there is no chance of 2 clients providing different data to REST service.

Any help highly appreciated.
HI,
I have an apex class which class external service. This serivce is supposed to load some metadata when called.
I was thinking that I will pass user's session id to external service, and using just session id it will be able to call that metadata api. But after searching on net for hours, I didn't find any post which allows you to call metadata api just based on session id.

Isn't it possible?

If not possible, then what are the alternates I have?

How does apps like conga composer access salesforce data without asking for username and password? Do they do OAuth?

Thanks,
Bakul
I have VF component which has certain input fields tied up with an object in controller variable as below:
<apex:outputLabel value="Field Name" for="fieldName"></apex:outputLabel>
<apex:inputField value="{!newField.Name}" id="fieldName"/> 
<apex:outputLabel value="Field Type" for="fieldType"></apex:outputLabel>
<apex:inputField value="{!newField.Type_of_Field__c}" id="fieldType">
<apex:actionSupport event="onchange" action="{!showValueField}" rerender="valuePanel"/>
</apex:inputField>
 
public Case_Dynamic_Field__c newField {get;set;}
After providing valule in newField.Name input field,  when I change selection in Type_of_Field__c, which is a picklist, it triggers a apex controller function call. In that function, I am debugging newField. There I am getting no values assigned to Name and Type_of_Field__c, while I was expecting values in both fields as provided in browser.

I have ensured that immediate is not used anywhere.
<apex:pageMessages/> does not render any message.
There is no actionRegion used
 
I am trying to upload a file using lightning component. I do have good understanding of the code involved, but for some reason the I try to get "files" from the input element type=file, it returns undefined.
 
var fileInput = document.getElementById("file1");
var file = fileInput.files;
I get undefined in 2nd line.

Anybody has file uploading working through lightning?
 
Hi,
I have created a REST service and exposed it through a site to allow creation of lead when form is submitted. REST end point is .../service/apexrest/WebToLeadService
Due to few complexities we can't use web to lead form.

The REST serivce is working fine as such, but I am noticing a strange behavior.
After a lead is created, one more duplicate lead is created automatically. This duplicate's name is Organization name.

Does anybody have idea why Salesforce would create a duplicate lead on its own?

Thanks
Bakul
Hi,
I have a situation wherein I want to hide products from users but still let them use pricebooks (through apex).
I have a trigger to assign default pricebook to opportunity. But I get an insufficient priviledges error, which is I think because I have take away access to prdoucts (which takes away access to pricebooks).

Does anybody have suggestion to take away access on products but still let users use pricebooks?

Bakul
Hi,
I am gettig this error on my RestResource class. I have just one method defined with annotation @HttpPost.
When client application calls this rest service, we ensure that it is sending POST request, not GET.

But still Salesforce compalins saying that HTTP Method 'GET' not allowed. Allowed are POST

Has anybody faced this error? any thoughts?

Thanks,
Bakul
Hello,
Does anybody have idea how to manage licenses and cost outside salesforce LMA for your salesforce app?
I am in process of developing an app which has licnese model different from per user license and I would like to custom manage it.

Thanks,
Bakul

Hi,

I have a VF page for custom object, which is parent object to many other children objects.

These children objects have lookup field to parent object.

So, there when child record is created, name of parent record appears on the page layout.

When you click on that link, it takes you to standard layout of the parent object. Instead of that, I want to take user to custom VF page that we have developed for parent object.

 

Can anybody tell me how to do that?

 

Thanks,

Bakul

Hi,

I have a VF page for custom object, which is parent object to many other children objects.

These children objects have lookup field to parent object.

So, there when child record is created, name of parent record appears on the page layout.

When you click on that link, it takes you to standard layout of the parent object. Instead of that, I want to take user to custom VF page that we have developed for parent object.

 

Can anybody tell me how to do that?

 

Thanks,

Bakul

Hi,

We are building a managed package.

It calls a webserivice on .Net application and sends some data there (like name, phone, email etc)

While doing this call, we pass a token (which is generated in .Net application and stored in User object)

 

I have 2 questions:

1. When calling .Net webservice, do I need to encrypt just token Or we need to also encrypt the data we are sending

2. If we have to encryp the data also, when how do we make it available to end user of that data?

 

Bakul

Hi,
I have a situation wherein I want to hide products from users but still let them use pricebooks (through apex).
I have a trigger to assign default pricebook to opportunity. But I get an insufficient priviledges error, which is I think because I have take away access to prdoucts (which takes away access to pricebooks).

Does anybody have suggestion to take away access on products but still let users use pricebooks?

Bakul
HI,
I am facing a strange problem. We have a Vendor_Vendor__c field in Product2 object which is lookup to Vendor object. When I am using that field in a tirgger, it complains that "Vendor_Vendor__c field not found in Product2 object" but I can clearly see that field being there. So, I tried to delete that field from Product2 object, but at that time it complained that it is being used in the same trigger.

It seems to be a case of oxymoron. Has anybody faced such problem earlier?
 I have following code in a REST service exposed through Force.com site
 
Case c = new Case (AccountId = '0019E000002pKMCQA2', description='est mgsg', Origin='Phone', Status='New');
insert c;

When I call this REST service from hurl.it, it works fine and creates case.
When I call this same REST service from different program, it fails. I get error Insert failed. First exception on row 0; first error: UNKNOWN_EXCEPTION, invalid parameter value: []

Pleaes note that all the field values are hard coded, so there is no chance of 2 clients providing different data to REST service.

Any help highly appreciated.
Hi all,
I am trying to build lightning components and I want to access the properties of an Apex controller in the components to display certain data. When try to display the values like in Visualforce (with added @AuraEnabled), it does not work. When I place the properties inside an inner class and create a method that has a return type as that inner class, then when I return a list of that class I can see the data. Bellow is the code which displays data, but I want to use it without an inner class and extra method to get that data. If anybody can help please let me know.

Thanks!

Apex:
public with sharing class EmployeeAvailability {
public static empAvailableInnerclass innerCList;
 
public class empAvailableInnerClass {
        @AuraEnabled
        public Decimal aetPerc {get;set;}
        @AuraEnabled
        public Integer totalEmployeesToday {get;set;}
        @AuraEnabled
        public Decimal budgetThisMonth {get;set;}
        @AuraEnabled
        public Decimal averageMargin {get;set;}
        @AuraEnabled
        public Object averageRate {get;set;}
        @AuraEnabled
        public Integer illnessToday {get;set;}
        @AuraEnabled
        public List<availableNextSixty> AvailableSixty{get;set;}
        @AuraEnabled
        public Date DateAfterTwoMonths {get;set;}

        public empAvailableInnerclass() {
            DateAfterTwoMonths=Date.today().addmonths(2);
        }
   }

@AuraEnabled
    public static empAvailableInnerclass getEmployeesDailyStatus(){
        runRetrieve();
        return innerCList;
    }
}

JavaScript controller:
getFixedTable : function(cmp, event, helper) {
        //debugger;
        var table = cmp.get("c.getEmployeesDailyStatus");
        table.setCallback(this,function(response){
            var state = response.getState();
            if (state === "SUCCESS") {
                cmp.set("v.tabTable",response.getReturnValue());
            } else if (state === "ERROR") {
                alert('Error : ' + JSON.stringify(errors));
            }
        });
        $A.enqueueAction(table);
    }


Lightning Component:
<aura:handler name="init" value="{!this}" action="{!c.getFixedTable}"/>
<aura:attribute name="tabTable" type="EmployeeAvailabilityLightning"/>

<table id="fixedTab">
            <thead>
                <tr>
                    <th>Total employees today : {!v.tabTable.totalEmployeesToday}</th>
                    <th>Budget this month : {!v.tabTable.budgetThisMonth}</th>
                    <th>Average Margin : {!v.tabTable.averageMargin} %</th>
                    <th>Available next 60 days : {!v.tabTable.AvailableSixty.size}</th>
                    <th>Employee hours available today : {!v.tabTable.aetPerc} %</th>
                    <th>Illness Today: {!v.tabTable.illnessToday}</th>
                </tr>
            </thead>
        </table>
Hi,
I have a situation wherein I want to hide products from users but still let them use pricebooks (through apex).
I have a trigger to assign default pricebook to opportunity. But I get an insufficient priviledges error, which is I think because I have take away access to prdoucts (which takes away access to pricebooks).

Does anybody have suggestion to take away access on products but still let users use pricebooks?

Bakul
Hi,
I am gettig this error on my RestResource class. I have just one method defined with annotation @HttpPost.
When client application calls this rest service, we ensure that it is sending POST request, not GET.

But still Salesforce compalins saying that HTTP Method 'GET' not allowed. Allowed are POST

Has anybody faced this error? any thoughts?

Thanks,
Bakul
Hi everyone,

This should be pretty easy but it's giving me bouts of grief.

I need to get the name of the person that approved a record into an HTML email template, as there are several possible approvers and they would all like to know who approved the record from an email sent on final approval/rejection, rather than logging into Salesforce (for various reasons - they'd like to know via email).

I tried using the LastModifiedBy name, which seems to be correct when I look at an approved record in the UI, but when I insert it in my email template as a field, it's blank when the approval/rejection takes place, and the email is sent- 

Any ideas on how I can accomplish this?

Thanks in advance.

 
I have a workflow rule that creates a task.  I need to set some custom field values on that task after it is created.  Do I need a trigger to do this?  If so, how would I write my trigger?

If the subject of the task created via workflow = 'Certified Receipt Req', I need to set the field Required__c to True, and the field From_Whom__c to 'USPS'.

Is this possible (i have to believe it is), and how?

Thank you!
I'm trying to drop messages on an Azure message queue for processing.  I have been able to build the HttpRequest, but am receiving a 403 - failed to authenticate message from Azure when calling the REST API.  I am using the following code:

string storageKey = 'removedforprivacy';

    Datetime dt = Datetime.now();
    string formattedDate = dt.formatGMT('EEE, dd MMM yyyy HH:mm:ss') + ' UTC';
    string stringToSign = 'POST\n\napplication/xml\n\nx-ms-date:' + formattedDate + '\n' +
                                      '/myqueue/testqueue/messages';

    // Sign the request
    Blob temp = EncodingUtil.base64Decode(storageKey);
    Blob hmac = Crypto.generateMac('HMacSHA256', Blob.valueOf(stringToSign), temp);
    string signature = EncodingUtil.base64Encode(hmac);
    Convert.ToBase64String(hmac.ComputeHash(Encoding.UTF8.GetBytes(stringToSign))));

    // This ends up being the exact same as the console app
    system.debug('SIGNATURE==>SharedKey myqueue:' + signature);

    HttpRequest req = new HttpRequest();
    req.setMethod('POST');
    req.setHeader('content-type', 'application/xml');
    req.setHeader('x-ms-date', formattedDate);
    string authHeader = 'SharedKey myqueue:' + signature;
    req.setHeader('Authorization', authHeader);

    req.setEndpoint('https://myqueue.queue.core.windows.net/testqueue/messages');

    req.setBody('<QueueMessage><MessageText>' + EncodingUtil.base64Encode(Blob.valueOf('This is a test from salesforce')) + '</MessageText></QueueMessage>');

    system.debug(req);

    Http http = new Http();

    try
    {
        HTTPResponse res = http.send(req);

        system.debug(res.toString());
        system.debug(res.getStatus());
        system.debug(res.getStatusCode());

    }
    catch (system.CalloutException ce)
    {
        system.debug(ce);
    }
I created a small .NET console app to verify how to create the request and the connectivity.  Once that was working, I verified the signed signature used in the Authorization header is the same when created both in .NET and in Salesforce.  Has anyone else came across this?  Is there something you can see in the code I have written?  Is there a way for me to capture the HttpRequest that is being posted by Salesforce (something similar to fiddler would be great)?
I am attempting to connect to an external application using Execute Anonymous in the Developer Console.
The application is using 2-Legged oAuth so I am encoding the signature in RSA-SHA1. Despite this, I seem to keep getting the result "Invalid Signature". Can anyone tell me if I am missing essential formatting in my code below for using oAuth?
Any help is greatly appreciated. I have also modified the Consumer Key and Private Key from thier true values, but maintained thier Size and special characters for a reference.

Http h = new Http();
String consumer_key='A1BF9UW7HS67STUOW8HUMKWODSJUOS';
                    
//Encoded PKCS8 Private Key
//Composed of Private Key Generated by OpenSSL
String secret_key='MIICXAIBAAKBgQDF9IiOjP0ZQcqGQ+Ut8K4Ug4vWe7' +
    'M6TRF+ruvVv1CtMOfZVV3kvtJPaNAD/bBs8W5wVFD+' +
    'tg+YhKL2nxkEKssdDNuyIOUa9OOQPbEBIjM7IJ8bRh' +
    '3kycneA0GPuNQIB3n5leCeCZtg56OR2WC8udc2FklQ' +
    'Jpvm0GWy+mvXC+DaewIDAQABAoGAce4+lgTROrMh88' +
    '0JCVugy1G/3UYfyxLeb26hVFPASmE635DRrLgbrjFL' +
    'qp4ZnvJwFa/1PxUWvso/3L9Or5ZNlmerHkdOdQhS3N' +
    'aUxDlB0RsCV7kwRVhaJbwsBKL07bYHqHCB3BE97xoN' +
    'Ak4ptsfEXYALeRnegSfpeq72fZGnYnECQQDrjPrfjH' +
    '9n5C60AfYgotQW6F52kHB6posgzltuTWh8UMaZUVD+' +
    'Td+mcDYIIlJnmG1qyL+v3Eu+CbBLDhY8HuXqNAbQCQ' +
    'RQkwEl1wGbrnyLeaKNH9t1yYmYwm93K+Vu9jAkEA1y' +
    'QCNs1A+IzbiUacbq1nzrstSzOdBCnLOeWBZRByqeYa' +
    'r6awJBANN5TcPYlli6/ME/a11Pjo6jZq5ZGaqR+nX6' +
    'JAeFJikDDPn/0yUicyV8d1OWJnZn8vxacvKIngsH6A' +
    'IgiM+iJMkiYnpFOtQScTj3S7PNcfNVAlz5mXuwvppA' +
    'pupU9KEU0h5iDRSXx/8UyUgHpcOWyKLewPp9FAnQyW' +
    'AF1+U0HSECQBVzu8CVaK7keNdOhHSgIsvCEdjzzA1P' +
    'd4uHbwGLObtCcxz2nwymQD4GZ8UMDZWLnX3/V2JbvQ' +
    'rlyKWHiMC6r5M=';

Long tmp=(System.now().getTime()/1000);

String encrypt_string = 'GET&https%3A%2F%2Fapi.xero.com%2Fapi.xro%2F2.0%2FContacts' +
                        '&oauth_consumer_key%3D' + consumer_key +
                        '%26oauth_nonce%3Dfef295f8188b8686fc922a66ec4fed2b' +
                        '%26oauth_signature_method%3DRSA-SHA1' +
                        '%26oauth_timestamp%3D' + tmp +
                        '%26oauth_token%3D' + consumer_key +
                        '%26oauth_version%3D1.0';


String algorithmName = 'RSA-SHA1';
String key =  secret_key;

// Decode the key from base64 to binary
Blob privateKey = EncodingUtil.base64Decode(key);
Blob input = Blob.valueOf(consumer_key);
Blob signature = Crypto.sign(algorithmName, input, privateKey);

String signatureA = EncodingUtil.base64Encode(signature);
String signatureB = EncodingUtil.urlEncode(signatureA, 'UTF-8');
System.debug('~~~ '+ signatureA);

// Try to get access token
HttpRequest req = new HttpRequest();
req.setEndpoint('https://api.xero.com/api.xro/2.0/Contacts' +
                        '?oauth_consumer_key=' + consumer_key +
                        '&oauth_nonce=fef295f8188b8686fc922a66ec4fed2b' +
                        '&oauth_signature=' + signatureB +
                        '&oauth_signature_method=RSA-SHA1' + 
                        '&oauth_timestamp=' + tmp +
                        '&oauth_token=' + consumer_key +               
                        '&oauth_version=1.0');
req.setMethod('GET');

// Send the request, and return a response
HttpResponse res = h.send(req);
System.debug('~~~ '+res.getBody());


Our client requires a Salesforce.com Technical Architect for a new implementation. Duration is 6+ months. The location is remote with some travel to the client site in the Midwest or West Coast.

 

Requirements:

- 3+ years of Salesforce.com experience

- 2 implementations as a lead/architect

- Extensive integration experience - legacy and 3rd party systems with Salesforce.com

- Utilize Google Dart or Web App development

- Must have some experience with Google Dart

 

To learn more about this role, please contact Dimple at dimple@rune2e.com or 678-533-4477.

 

RunE2E is a leading provider of integrated IT consulting, workforce and technology solutions. We offer BI, CRM, HCM and Cloud consulting and contingent workforce services to give IT departments greater expertise and more resources. Our technology solutions from leading business software and cloud infrastructure partners help companies of all sizes harness data, increase revenue and enhance efficiency.

 

  • September 12, 2013
  • Like
  • 0

Hi,

 

How do we convert String to Byte?

 

Thanks,

Prasad

HI,

 

The requirement is authentication between webservice and salesforce. 

I have created webservice in .net which is import and export data in excel sheet.

i have built one page which has list of salesforce user in .net, it will display in salesforce(for that i used web tab).

if administrator select one of user from the list and save it.it will save userId,Username and new generated security token in sql server and update that security token in according user record in salesforce. 

when salesforce user request the webservice it will check with username and token.whether this user has permission or not and preceed further.

 

I am getting this issue, when i request webservice from salesforce.

 

Insecure Storage of Sensitive Data Vulnerability

If your application copies and stores sensitive data that originated at salesforce.com, you should take extra precaution. Salesforce.com takes threats to data that originated at their site very seriously, and a data breach or loss could jeopardize your relationship with salesforce.com if you are a partner.

If you must store passwords (including non-Salesforce passwords), note that storing them in plaintext or hashed (such as with the MD5 function) makes your application vulnerable to mass user exploitation if an attacker can get access (even just read-only access) to your database (such as through stealing a backup tape or SQL injection). Although a successful SQL injection or data exposure attack is a huge problem in itself, if the attacker can recover passwords from the data, they cantransparently compromise user accounts on a mass scale.

 

My question is,

if i convert username and token before saving into the sql server, it will solve my problem..?

i would like to inform that, i am using lead data in webservice..

This data also i want to convert it into the mdf before import or export in excel sheet..?

 

Please help me, to solved this issue.

 

Thanks & Regards,

Nilesh Badrakiya

 

hi,

 

just like to ask if am i missing some items when doing the changeset deployment?

im having an error in deploying a report having a bucketfield

 

thanks in advance,

mark

  • May 02, 2012
  • Like
  • 0

I am trying to write a batch apex job that will cycle through a list of records..

 

For each record, I need to get the VF Document related to it as a PDF and email it as an attachment.

 

The PDF always comes across as blank. I know I must bemissing something small because the exact same code works in a static apex class......

 

Can someone please help me resolve this?

 

Note: the code attached just attaches the file to the object for testing purposes...

 

this is the execute method. Everything else works except the actual PDF is empty

 

 

Map<ID,MYOBJECT__c> mFSA = New Map<ID,MYOBJECT__c>((MYOBJECT__c[])(database.query(query)));
    
    
    PageReference pr;
    blob pdf;
    
    For(FSA__c f : mFSA.values()){
    
        pr = New PageReference('/apex/ReportPDF?id=' + f.id ); 

        pdf = pr.getContentAsPDF();
        
        Attachment a = New Attachment();
        a.body = pdf;
        a.parentID = f.id;
        a.Name = 'FSA.pdf';
        insert a;
        
    
    }


 

hello Experts,

 

I m facing same problem. Please help me out

 

Web service callout failed: Unexpected element. Parser was expecting element 'http://schemas.xmlsoap.org/soap/envelope/:Envelope' but found ':HTML'

 

Thank in advance.