. . . RecRef.OPEN(18); //this you know . . . //Here we will open the base form to an Record HYPERLINK(CreateHyperlink(RecRef,21); RecRef.CLOSE(); CreateHyperlink(VAR RecRef : RecordRef;FormID : Integer) : Text[1024] PreFix := '0'; //Form, Report ist 1 KeyString := FORMAT(RecRef.KEYINDEX(1)); //PK FieldNoTxt := DELCHR(KeyString,'=','Field'); REPEAT IF (STRPOS(FieldNoTxt,',') > 1) THEN BEGIN SingleNoTxt := COPYSTR(FieldNoTxt,1,STRPOS(FieldNoTxt,',') - 1); EVALUATE(FieldNo,SingleNoTxt); FieldValue := FORMAT(RecRef.FIELD(FieldNo).VALUE); FieldNoTxt := COPYSTR(FieldNoTxt,STRPOS(FieldNoTxt,',') + 1,100); PosStr := PosStr + 'Field' + SingleNoTxt + '=' + PreFix + '(%22' + FieldValue + '%22),'; END; UNTIL (STRPOS(FieldNoTxt,',') = 0); EVALUATE(FieldNo,FieldNoTxt); FieldValue := FORMAT(RecRef.FIELD(FieldNo).VALUE); PosStr := PosStr + 'Field' + FORMAT(FieldNo) + '=' + PreFix + '(%22' + FieldValue + '%22)'; TxtStr := CONTEXTURL + '%26target=Form' + '%20' + FORMAT(FormID) + '%26view=SORTING(' + FORMAT(KeyString) + ')' + '%26position=' + PosStr; EXIT(TxtStr);
Comments
and then, whenever you want to lookup another table, you have to export the blob of codeunit above to file/stream (it is stored in table Object), change the binary code of exported file/stream so that new ID of recTmp would be assigned and import the blob back to table Object.
You can find the places where navision stores the record No by exporting blob of codeunit with several variations of record No of recTmp in codeunit above. In my situation it changes in two places: from bytes 536 and 1088.
The code would look like smth like that:
This smells of 'breaking navision', but it works great! Even with several concurent users. But just be carefull with user permissions for table 'Object'.
Have fun!
http://navisionfreak.blogspot.com/
Justas Janauskas
Thx, it does work in 4.0 and later on in 5.0. even with the same fob.
The only problem is that you can not apply filters to the record, because they get lost when you assign RecRef to the Variant variable. First record in the filter DOES get selected though. Example below:
I hope that helps someone else too.
I tried if form.runmodal(var,0) = action::lookupOK....but this didn't go anywhere. Version 2009R2.
Help?