Search This Blog
December 13, 2018
[Solved]Error while code check-in in visual studio ‘Could not find file….’
Hi Folks,
Here is a quick trick. I was trying to check-in a few objects in a solution and encounter a strange error.
Error:
Could not find file 'C:\Users\Adminbefabcsd4\Documents\Visual Studio 2015\Projects\<MySolution>\<MyProject>\<MySolution>.btproj
Possible reason: If you are trying to check-in your object along with the solution file, you might get this error.
Possible solution: I cannot say it a permanent fix as I didn't find any technical reason for this, but below fix worked for me.
If you didn't make any changes in the solution itself, like adding/deleting a file, you should not include solution file in included changes. Remove solution file and check-in only object which you actually made changes.
Cheers!!!
Harry
December 11, 2018
Create delivery address run time
Folk,
Here is quick code to create the delivery address on runtime. You can use this on Purchase Requisition, Purchase order or a person.
So we are going to use LogisticsPostalAddressEntity to get the right address with a new one or an existing one. This code should also handle if there is any update in any existing record by updating effective date stamp.
Have a look on below code,
Give a try and share your feedback.
Cheers!!!
Harry.
Here is quick code to create the delivery address on runtime. You can use this on Purchase Requisition, Purchase order or a person.
So we are going to use LogisticsPostalAddressEntity to get the right address with a new one or an existing one. This code should also handle if there is any update in any existing record by updating effective date stamp.
Have a look on below code,
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Public static LogisticsPostalAddressRecId createAddress(tmpNewAddress _tmpNewAddress) | |
{ | |
LogisticsPostalAddress deliveryAddress; | |
LogisticsPostalAddressEntity postalAddressEntity; | |
LogisticsPostalAddressView addressView; | |
DirPartyPostalAddressView partyAddressView; | |
// get location from current user setup | |
LogisticsLocation logisticsLocation = LogisticsLocation::find(HcmWorkerTitle::findByWorker(curUserId()).Location); | |
//Address type default to delivery | |
LogisticsLocationRole logisticsLocationRole = LogisticsLocationRole::findBytype(LogisticsLocationRoleType::Delivery); | |
CompanyInfo companyInfo = CompanyInfo::findRecId(‘USMF’); //you may need to get if from current logged in user. | |
//if current user doesn't have setup for location try to get it from LogisticsLocationDefault class | |
if (!logisticsLocation) | |
{ | |
HcmWorker hcmWorker = HcmWorker::find(HcmWorker::userId2Worker(curUserId())); | |
logisticsLocation = LogisticsLocationDefault::findSimpleDefault(hcmWorker, logisticsLocationRole); | |
} | |
//if location is still empty get it from companyInfo | |
if (!logisticsLocation) | |
{ | |
logisticsLocation = LogisticsLocationDefault::findSimpleDefault(companyInfo, logisticsLocationRole); | |
} | |
//Below code to set buffer with the new address values | |
deliveryAddress.clear(); | |
deliveryAddress.initValue(); | |
deliveryAddress.CountryRegionId = SysUserInfo::find().DefaultCountryRegion; | |
deliveryAddress.Street = _tmpNewAddress.streetAddress; | |
//add other fields in same way | |
partyAddressView.initFromPostalAddress(deliveryAddress); | |
partyAddressView.LocationName = logisticsLocation.Description; | |
postalAddressEntity = LogisticsPostalAddressEntity::construct(); | |
addressView.initFromPartyPostalAddressView(partyAddressView); | |
deliveryAddress = postalAddressEntity.createPostalAddress(addressView); | |
return deliveryAddress.RecId; //return the LogisticsPostalAddress table recId which directly can flow in respective table. | |
} |
Give a try and share your feedback.
Cheers!!!
Harry.
Subscribe to:
Posts (Atom)