• Kimberly Sullivan
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 2
    Questions
  • 1
    Replies
Hello,

This has been a discussion many times at my office. We are a C# development shop mostly but about 2 years ago started supporting our salesforce org. We do a fair amount of development in apex now and have been doing lots of deployments as our organization is using Salesforce more and more. When we do a deployment into our full sandbox and into production org we always run all unit tests (not just local).

We have a couple managed packages in our org and once in a while there is an update and their unit tests fail. Our standard procedure when this happens is to halt all our deployments until we figure out how to fix the test or the support team for the app fixes the test. Does everyone operate this way? I've tried checking out SF best practices and don't see much on how many tests to run. Often we are told by app support to run local tests and continue with deployments but this seems risky. Other times we are told that our custom code is causing that problem. If our custom code can break a managed package unit test doesn't that mean our custom code could break the managed package?

How are other dev teams handling this?

Thank you in advance!
I'm trying to create a HmacSHA256 hash that will return the same value as my C# external service hash.
Currently I cannot get them to match, can someone see where I'm going wrong?

Apex:
public String CreateToken(string jsonData, Datetime timestamp, String transactionKey)
	{
		String algorithmName = 'HmacSHA256';
		Long epochTime = timestamp.getTime()/1000;
		String payload = jsonData + '^' + epochTime;

		System.debug('algorithmName: ' + algorithmName);
		System.debug('Datetime: ' + epochTime);
		System.debug('payload: ' + payload);

		Blob token = Crypto.generateMac(algorithmName, blob.valueOf(payload), blob.valueOf(transactionKey));

		return (EncodingUtil.convertToHex(token)).replace('-','').toLowerCase();
	}

C# Code
private static string ComputeHash(string jsonData, DateTime timestamp, string trasactionKey)
        {
            var key = Encoding.UTF8.GetBytes(trasactionKey);
            var payload = Encoding.UTF8.GetBytes(string.Format("{0}^{1}", jsonData, ToUnixTime(timestamp)));
            using (var hmacSHA = new HMACSHA256(key))
            {
                var hash = hmacSHA.ComputeHash(payload, 0, payload.Length);
                return BitConverter.ToString(hash).Replace("-", "").ToLower();
            }
        }

I have got the timestamps to match.

Any help is greatly appreciated. Thanks!
Hello,

I created a scratch orgs without problems and now I am trying to push the source from the local branch.
I am getting 68 errors of this type:
An object 'Account.ParentId' of type CustomField was named in package.xml, but was not found in zipped directory
All the mentioned fields are in the sfdx project source under main/default/objects/Account/fields and the scratch org API version matches the project one. 
Could anyone help me understand what I'm doing wrong, please?

Many thanks!
Sabina
 
Hello,

I created a scratch orgs without problems and now I am trying to push the source from the local branch.
I am getting 68 errors of this type:
An object 'Account.ParentId' of type CustomField was named in package.xml, but was not found in zipped directory
All the mentioned fields are in the sfdx project source under main/default/objects/Account/fields and the scratch org API version matches the project one. 
Could anyone help me understand what I'm doing wrong, please?

Many thanks!
Sabina