code:-
appl.setDefaultCompany(Legalentitycode, false);
code:-
appl.setDefaultCompany(Legalentitycode, false);
code:-
sql:-
select DISTINCT vendPackingSlipTrans.PACKINGSLIPID from vendInvoiceTrans
inner join vendInvoiceJour
on vendInvoiceTrans.PurchID = vendInvoiceJour.PurchId and
vendInvoiceTrans.InvoiceId = vendInvoiceJour.InvoiceId and
vendInvoiceTrans.InvoiceDate = vendInvoiceJour.InvoiceDate and
vendInvoiceTrans.NumberSequenceGroup = vendInvoiceJour.NumberSequenceGroup and
vendInvoiceTrans.InternalInvoiceId = vendInvoiceJour.InternalInvoiceId
inner join vendInvoicePackingSlipQuantityMatch
on vendInvoicePackingSlipQuantityMatch.InvoiceSourceDocumentLIne = vendInvoiceTrans.SourceDocumentLine
inner join vendPackingSlipTrans
on vendPackingSlipTrans.SourceDocumentLine = vendInvoicePackingSlipQuantityMatch.PackingSlipSourceDocumentLine
and vendInvoiceJour.LEDGERVOUCHER='pass your journal vocuher'
Step1;- Here my Role name I want to assign is System admin
SELECT RecId,* FROM SecurityRole WHERE Name = 'System administrator';
step 2:- User name here is sai and pass recid from above to below query
insert into SECURITYUSERROLE (USER_, SECURITYROLE, ASSIGNMENTSTATUS, ASSIGNMENTMODE)
VALUES ('sai', 171,1,1);
Thats it!! refresh and check
For deleting of roles through SSMS
Step1:-SELECT RecId,* FROM SecurityRole WHERE Name = 'System administrator';
pass recid from above to below query
Step 2:-DELETE FROM SECURITYUSERROLE WHERE USER_='sai'and SECURITYROLE=171;
Thank you!!
To get all dimension with - separated with provided dimension recid
Code:-
public static str Getdimensionset(RecId recid)
{
str descriptionLedgerLoc = '';
boolean first = true;
DimensionAttributeLevelValueAllView view,viewloc;
DimensionAttributeValue dimValue;
DimensionAttributeValueGroup dimensionAttributeValueGroup;
container con;
select firstonly viewloc
where viewloc.ValueCombinationRecId==recid;
while select view order by view.ValueOrdinal asc
where view.ValueCombinationRecId == recid
&& view.DimensionAttributeValueGroup==viewloc.DimensionAttributeValueGroup
{
if (!first)
{
descriptionLedgerLoc += " - ";
}
descriptionLedgerLoc +=view.DisplayValue ;
first = false;
}
return descriptionLedgerLoc;
}
Note:-dimensions will get with - separated
Thank you!!
To get Dimensions value as displayed in Control level
Code:-
LedgerDimensionFacade::getDisplayValueForLedgerDimension(DimensionRecid);
Note:- dimensions will get with ~ separatedlink to run a class from front end through sysclassrunner
dynamics url/?mi=SysClassRunner&cls=classname
Scenario:- When you need to get amount with required exchange rate.
Case :- It also depends on whether we are going with Account currency exchange rate or Budget exchange rate type as shown in image below
Case 1:- If it is Budget exchange
Code:-
CurrencyCode currencyCode = SystemParameters::find().SystemCurrencyCode;
str fromcurrency='USD';
str tocurrency='CAD';
real amount=120;
CurrencyExchangeHelper currencyExchangeHelper;
currencyExchangeHelper = currencyExchangeHelper::construct();
currencyExchangeHelper.parmLedgerRecId(Ledger::current());
currencyExchangeHelper.parmExchangeRateTypeRecId(Ledger::budgetExchangeRateType());
Info(strFmt("%1",currencyExchangeHelper.calculateCurrencyToCurrency(fromcurrency, tocurrency,amount, true)));
Case 2:- If it is Account currency exchange rate
Code:-
CurrencyCode currencyCode = SystemParameters::find().SystemCurrencyCode;
str fromcurrency='USD';
str tocurrency='CAD';
real amount=120;
CurrencyExchangeHelper currencyExchangeHelper;
currencyExchangeHelper = currencyExchangeHelper::construct();
currencyExchangeHelper.parmLedgerRecId(Ledger::current());
currencyExchangeHelper.parmExchangeRateTypeRecId(Ledger::defaultExchangeRateType());
Info(strFmt("%1",currencyExchangeHelper.calculateCurrencyToCurrency(fromcurrency, tocurrency,amount, true)));
code:- appl.setDefaultCompany(Legalentitycode, false);